Log in

View Full Version : 10-bit YUV Level Adjustments


magikarp99
20th April 2014, 10:22
I have a 10-bit YUV video that I want to perform luma and chroma level adjustments on, and then down-sample to 8-bit video.

Can anyone advise on a good way to do this? I primarily use Linux if that makes any difference, I see mention of avs2yuv when Googling.

Reel.Deel
20th April 2014, 17:07
I don't have any experience with AviSynth under Linux but this thread seems to have the appropriate information: http://ubuntuforums.org/showthread.php?t=1333264

To do high bit depth color correction SmoothAdjust (http://forum.doom9.org/showthread.php?t=154971) is the tool to use and to convert to 8-bit you can either use Dither (http://forum.doom9.org/showpost.php?p=1386559&postcount=3) or f3kdb_dither (part of flash3kyuu_deband (http://forum.doom9.org/showthread.php?t=161411)).

magikarp99
20th April 2014, 20:53
Thanks for the input. That filter is just what I was looking for.

There is one more question. The YUV video format is v210 y422p10le. How can I read this into Avisynth, ensuring that it is processed in 10-bit?

Guest
20th April 2014, 21:02
http://avisynth.nl/index.php/High_bit-depth_Support_with_Avisynth

magikarp99
22nd April 2014, 21:46
Thank you. This leads to some confusion though.

It opens saying:
Currently, Avisynth only supports 8-bit video.
But then it says:
Uses Avisynth 2.6's new colorspace. You can process with the full quality of the format.

If I understand this correctly, does this mean that I must use Avisynth 2.6 in order to process video in 10-bit?

That wiki page is a mess of information.

Asmodian
23rd April 2014, 01:09
Avisynth only supports 8-bit.

The patched ffms2/ffms2-ffmbc can use a fake 16-bit (it is a stacked format, double height with LSB in the bottom half). The Avisynth 2.6 color spaces are not needed for the bit depth but the 4:2:2 and 4:4:4 color spaces.

The >8 bit workflow is fairly mature now, at least all the pieces I have needed are present and work, and it is relatively well documented but it is all still convoluted compared to 8 bit.

Note: you will need to pipe (I use AVS2pipemod) to x264 to pass it >8 bit data.

Reel.Deel
23rd April 2014, 01:33
If I understand this correctly, does this mean that I must use Avisynth 2.6 in order to process video in 10-bit?

That wiki page is a mess of information.

Yes that page is indeed a mess (a bit outdated too). You do not need AviSynth 2.6 to process 16-bit data, but since >8-bit filters only allow planar formats.
This means in AviSynth 2.5 you're limited to only processing high bit depth data in YV12 while in 2.6 you can process >8-bit in Y8, YV12, YV16, and YV24. Thus 2.6 is highly recommended.

Regarding importing >8-bit video, I recommend L-SMASH-Works (http://forum.doom9.org/showthread.php?t=167435).

You can download r715 here: https://drive.google.com/folderview?id=0BwV03nn6LPd9OXJUWVVMMXZmNUU&usp=sharing

And here's the README that comes with the plugin:https://raw.githubusercontent.com/VFR-maniac/L-SMASH-Works/master/AviSynth/README

magikarp99
23rd April 2014, 09:24
How can I make sure the video I am processing is being processed in 10-bit?

If I do open the video with ffms2, then it appears to be YUY2. SmoothAdjust will not accept YUY2, and I assume conversion using ConvertToYV12() will not result in a high bit-depth.

Asmodian
24th April 2014, 00:48
If it is YUY2 it is also 8-bit. It should be YV16.

If you open the avs in VirtualDub you can see the LSB in the bottom half, it doesn't look like an image but if it is uniform the source came in as 8-bit.

I would also give L-SMASH-Works a try.

magikarp99
24th April 2014, 19:21
LSmash looks really good but I am having problems. Whenever I try to load a video it just echoes the following.

LSMASHVideoSource: the number of tracks equals 0.

Edit: Disregard this.
I needed to use "LWLibavVideoSource()" instead.
For future reference to get 10-bit video working with FFVideoSource you need to pass the argument enable10bithack=true

magikarp99
24th April 2014, 19:46
The next question is this. How do I get SmoothAdjust to process my stacked video as 10-bit rather than two stacked 8-bit frames?

sneaker_ger
24th April 2014, 19:54
SmoothLevels16(...), SmoothTweak16(...), SmoothCurve16(...), SmoothCustom16(...), SmoothTools16(...) for 16 bits

Also, see included readme chapter XIV.

mp3dom
26th April 2014, 01:31
Your video will always be opened as 16bit (8bit + 8bit in stacked form), so if you open a 10bit video you will have 8bit for MSB and 2bit (+6 empty bits) for LSB. If you adjust something (deband, resize, adjust levels, curves and so on) the final video will be at full 16bit precision (clearly visible because your LSB will start to "grow").

magikarp99
27th April 2014, 12:46
Thanks for all the help. Got it all working :)