Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
16th August 2016, 23:06 | #1 | Link |
Registered User
Join Date: Apr 2008
Posts: 18
|
yuv422p10 AVISynth output
Hi guys, really hoping someone can provide some support here... Apologies if this has been answered elsewhere previously, but I have spent quite a bit of time researching the answer for this and either this does not appear to be possible, or the solution is simply alluding me:
Is there any method to achieve full 10bit 4:2:2 output direct from an AVISynth script? I have some UHD AVC High 4:2:2 Intra Profile files in a MXF wrapper that I need to ingest into another application which does not have native support for this type of file, and was hoping to use an AVISynth script as the intermediary as AVS scripts are directly supported by the application. I have been able to use AVISynth 2.6 MT with both ffms2 (with enable10bithack=true) and LSMASHSource to successfully import the source(s) into AVISynth and properly decode them as 2x 8bit stacked frames (MSB + LSB). However, this is as far as I can get, as I am clueless as to how to then be able to merge or return those frames as true non-stacked 10bit to other 'basic' applications which can only handle the AVS script in its native output. Basically, at a minimum, I need to be able to output from AVISynth a script which directly produces the video in raw YUV422P10 (or YUV420P10) or v210 formats. No AVISynth processing or filtering is required for these files other than decode. Any help that can be provided would be greatly appreciated! Thanks!! |
17th August 2016, 00:14 | #2 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,419
|
You're [kind of] in luck. AviSynth+ has been implementing high bit depth output over the last two months, and a couple days ago the 10/12/14 support was committed. All you have to add is ConvertFromStacked(10) or ConvertFromDoubleWidth(10) based on whether the source filter (or f3kdb or Dither) is giving you stacked or interleaved. ConvertFromStacked/DoubleWidth defaults to 16 bits, so if the input into that plugin isn't 16, you do need to know what the source bit depth was and specify that - but that's usually going to be obvious to the user.
But there is a problem greater than simply being able to output it without hacks. The receiving application needs to know that AviSynth is outputting that pixel format as well. Last edited by qyot27; 17th August 2016 at 00:18. |
17th August 2016, 05:39 | #3 | Link | |
Registered User
Join Date: Apr 2008
Posts: 18
|
Thanks for the fast response qyot27! Unfortunately, I seem to have hit a roadblock... Here is an example of my simple script I am trying to load in AvsPmod and AVISynth+ r2161:
LWLibavVideoSource("source.mxf", format="YUV422P10", stacked=true)or ffvideosource("source.mxf", enable10bithack = true)Without the ConvertFromStacked(10) line, the source loads with both plugins into AvsPmod and defaults to YV16. But with this line, I get the following message: Quote:
Thanks for the insight into AVISynth+ btw! I was unaware of this project until tonight but like what I have seen thus far... |
|
17th August 2016, 05:53 | #4 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,346
|
What is the other application? 99.99% won't accept a hacky 10bit avisynth script as-is
I think a proven, better workflow is just to encode to another intermediate like v210 directly which will be accepted. eg. use ffmpeg Since you're not using avisynth for any other processes, just decoding, it makes more sense. The only reason I can see using avisynth or vapoursynth is if you want to control the algorithm for the bit depth conversion if you're starting from 8bit. You only said "UHD AVC High 4:2:2 Intra Profile" , which can be 8bit or 10bit, but you're using "format="YUV422P10" in l-smash so that suggests 10bit eg. (Assuming you don't want audio) Code:
ffmpeg -i input.mxf -c:v v210 -an output.mov Last edited by poisondeathray; 17th August 2016 at 06:02. |
17th August 2016, 06:49 | #5 | Link | |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,419
|
Quote:
You could use f3kdb to fix it up if you want to test 16-bit: Code:
sourcefilter() f3kdb(input_depth=10, output_depth=16, output_mode=2) # mode 2 is interleaved, mode 1 is stacked ConvertFromDoubleWidth() # or ConvertFromStacked() |
|
17th August 2016, 15:37 | #7 | Link | ||
Registered User
Join Date: Apr 2008
Posts: 18
|
Quote:
Quote:
Still a no go unfortunately. Appears that your doubts were justified. The application I need to use (32bit Windows) with this source file can accept AVISynth scripts, and works well with standard uncompressed 10bit source files (though possibly not with AVISynth 10bit files; however, this could be managed by updating the application to then support AVISynth 10bit output if I can get at least get 10bit working initially). If it would help, I have posted a very short example clip here. |
||
17th August 2016, 15:57 | #8 | Link | ||
Registered User
Join Date: Sep 2007
Posts: 5,346
|
Quote:
Large storage space for v210, yes, but it's stable. You can look at sneaker's suggestion of virtual files with vsfs, but once you more than a few, they will crash most compositing/NLE software. avfs will only support 8bit EDIT: I didn't see this Quote:
Last edited by poisondeathray; 17th August 2016 at 16:12. |
||
17th August 2016, 16:56 | #9 | Link | |||
Registered User
Join Date: Apr 2008
Posts: 18
|
Quote:
Quote:
Quote:
If there's no method to really get this working, that'd be unfortunate, but so be it. I could certainly get the ffmpeg method working by directly scripting that within the application, but would prefer to use a frame server versus a frame writer for this project. Again, thanks for your time and thoughts on this thus far. |
|||
17th August 2016, 19:13 | #10 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,419
|
As I mentioned just a few posts ago, AviSynth+ does now, at least as far as output goes. The filters may not have been updated yet, but that's not what applications using AviSynth care about.
FFmpeg should have the patch that supports this committed soon, and after that, anything built against libavformat will too (provided it was built with --enable-avisynth). It may take a couple days for Zeranoe's ffmpeg builds and the mpv daily builds to get rolled out, but when that happens you'll be able to demonstrate that it works. Mostly it's just a matter of using the AviSynth+ avisynth.h or avisynth_c.h header from the 'MT' branch and allowing the program to recognize the new pixel type constants (and there's a bunch of them that were just added). That is, if the program talks to AviSynth.dll directly and not through the Video for Windows interface (who knows how something that does it that way might support extra pixel formats). |
18th August 2016, 00:35 | #11 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,419
|
Using a build of AviSynth+ from my mingwfix branch, and a build of FFmpeg including my patches for it to support AviSynth+'s high bit depths, a script containing:
Code:
FFVideoSource("AVC-I_422_10bit_UHD_1f.mxf",enable10bithack=true) ConvertFromStacked() Code:
>avsmeter test.avs AVSMeter 2.3.7 (x86) - Copyright (c) 2012-2016, Groucho2004 AviSynth+ 0.1 (r2183, mingwfix, i386) (0.1.0.0) Number of frames: 5 Length (hh:mm:ss.ms): 00:00:00.100 Frame width: 3840 Frame height: 2160 Framerate: 50.000 (50/1) Colorspace: YUV422P16 Frames processed: 5 (0 - 4) FPS (min | max | average): 1.489 | 1.907 | 1.777 Memory usage (phys | virt): 390 | 430 MiB Thread count: 17 CPU usage (average): 26% Time (elapsed): 00:00:02.813 Code:
ffmpeg -i test.avs -frames:v 1 -qscale:v 1 test.jpg Code:
>ffmpeg -i test.avs ffmpeg version r81319 git-8e8aff8 Copyright (c) 2000-2016 the FFmpeg developers built on Aug 9 2016 23:50:26 with gcc 6.1.0 (GCC) libavutil 55. 28.100 / 55. 28.100 libavcodec 57. 51.100 / 57. 51.100 libavformat 57. 46.100 / 57. 46.100 libavdevice 57. 0.102 / 57. 0.102 libavfilter 6. 50.100 / 6. 50.100 libavresample 3. 0. 0 / 3. 0. 0 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 1.100 / 2. 1.100 libpostproc 54. 0.100 / 54. 0.100 Input #0, avisynth, from 'test.avs': Duration: 00:00:00.10, start: 0.000000, bitrate: 7 kb/s Stream #0:0: Video: rawvideo (Y3[10][16] / 0x100A3359), yuv422p16le, 3840x2160, 50 fps, 50 tbr, 50 tbn, 50 tbc At least one output file must be specified That patch is not yet in FFmpeg, though (and the one I linked to is slightly earlier from the one on FFmpeg-devel's mailing list; it lacks the USING_AVISYNTH ifdefs to protect FFmpeg from failing to compile on Linux; for Windows builds it doesn't affect anything). If you want to try with an FFmpeg build that contains that patch, use this one: http://www.mediafire.com/download/b5...mpeg_r81319.7z The 7zip also has ffplay in there, so you can just watch the script. Remember, though, that's not yet in upstream FFmpeg, I'm just providing it so you can see it actually works. Last edited by qyot27; 18th August 2016 at 00:38. |
18th August 2016, 00:51 | #12 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
__________________
Groucho's Avisynth Stuff |
|
18th August 2016, 05:54 | #14 | Link | ||
Registered User
Join Date: Apr 2008
Posts: 18
|
Quote:
You also confirmed the exact same behavior I was seeing on my system with FFMS2 (only could get YV16 to output) and LwLibavVideoSource (solid green on all >8bit pixel formats). I was hoping that this may have been just a configuration error on my end, but glad to see it confirmed nonetheless. Quote:
Amazing work here qyot27!!! I owe you a beer or something... |
||
18th August 2016, 18:30 | #15 | Link | |
Registered User
Join Date: Apr 2008
Posts: 18
|
Quote:
Code:
ffvideosource("source.mxf",enable10bithack=true) ConvertFromStacked() Dither_quantize(bitdepth=10) Dither_out() Code:
mt_lut : unsupported colorspace. masktools only support planar YUV colorspaces <YV12, YV16, YV24> |
|
18th August 2016, 19:05 | #16 | Link | |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,419
|
Quote:
And Dither currently only works on 8-bit input sources (which would include stacked format, although it might require passing an option to make it see it that way). Dither_out also only outputs in hack format, so you'd have to re-do ConvertFromStacked/DoubleWidth afterward anyway. I'd rather use flash3kyuu_deband: Code:
ffvideosource("source.mxf", enable10bithack=true) f3kdb(input_mode=1, output_depth=10, output_mode=2) ConvertFromDoubleWidth(10) Last edited by qyot27; 18th August 2016 at 19:08. |
|
18th August 2016, 20:01 | #17 | Link | ||
Registered User
Join Date: Apr 2008
Posts: 18
|
Quote:
Quote:
As always, thanks for your continued assistance! |
||
18th August 2016, 21:16 | #19 | Link |
Registered User
Join Date: Apr 2008
Posts: 18
|
So it appears I did have an older version installed... but that did not resolve the issue. Also, whenever I try to use ConvertFromDoubleWidth(10) or ConvertFromStacked(10), I get
Code:
Script error: Invalid arguments to function 'ConvertFrom...' |
Thread Tools | Search this Thread |
Display Modes | |
|
|