Log in

View Full Version : Unwanted YUV conversion.


Spiderm@n
31st July 2017, 17:03
Hi,
I'm trying to convert a screen recording from UtCodec to x264 raw (I mux it later after converting the audio). However, I'm getting the following message:
avs [info]: 1920x1200p 0:0 @ 60/1 fps (cfr)
resize [warning]: converting from yuv422p to yuv420p

However, the info of the source file is:
Video
ID : 0
Format : YUV
Codec ID : ULH0
Codec ID/Info : Ut Video Lossless Codec
Codec ID/Hint : Ut Video
Duration : 14 min 37 s
Bit rate : 817 Mb/s
Width : 1 920 pixels
Height : 1 200 pixels
Display aspect ratio : 16:10
Frame rate : 60.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Compression mode : Lossless
Bits/(Pixel*Frame) : 5.908

The result is that the encoded version looks some how brighter with less contrast than the source. How can I hix it, and is this the problem to start with?

I'm using x264.exe w/o GUI, AviSynth command or a key for x264 not to make that conversion both works (kind of prefer the key for x264 though). Thanks in advance.

sneaker_ger
31st July 2017, 17:13
You can avoid x264's conversion by setting --output-csp i422
But the conversion shouldn't usually affect the brightness. How does your AviSynth script look like? Try using ffvideosource() as source filter.

Also make sure it isn't just a playback difference. Upload input and output sample.

Spiderm@n
31st July 2017, 17:49
I actually input the avi file directly, but with simple AVISource avs script it's the same. What bothers me, is that the source should be 420 already, as that was the recording source and the one that came out of Premiere.

sneaker_ger
31st July 2017, 17:51
Did you already try ffvideosource()?

poisondeathray
31st July 2017, 17:54
For AVISource(), some formats require you to specify the pixel_type . UT Video is one of them. This is discussed in the UT Video Codec thread. Otherwise YV12 is returned

See post 562, 563
https://forum.doom9.org/showthread.php?t=143624&page=29

What I don't understand is other types automatically communicate that info. For example, lagarith in YUY2 mode, will automatically return YUY2

sneaker_ger
31st July 2017, 17:55
Otherwise YV12 is returned
But then x264 shouldn't be receiving yuv422p? :confused:

poisondeathray
31st July 2017, 18:01
But then x264 shouldn't be receiving yuv422p? :confused:

Yes, my bad - I was confused by what you said


You can avoid x264's conversion by setting --output-csp i422


He actually has ULH0 or YUV 4:2:0 BT.709 , yes it should be getting 4:2:0

Maybe double check with
AVISource()
Info()

poisondeathray
31st July 2017, 18:06
I actually input the avi file directly, but with simple AVISource avs script it's the same. What bothers me, is that the source should be 420 already, as that was the recording source and the one that came out of Premiere.

What was the recording source format ?

Premiere doesn't treat all YUV sources as YUV . You might have had some other conversions going on.

sneaker_ger
31st July 2017, 18:15
Yes, my bad - I was confused by what you said



He actually has ULH0 or YUV 4:2:0 BT.709 , yes it should be getting 4:2:0

Maybe double check with
AVISource()
Info()
Yeah, it's weird.
resize [warning]: converting from yuv422p to yuv420p

Spiderm@n
31st July 2017, 18:41
What was the recording source format ?

Premiere doesn't treat all YUV sources as YUV . You might have had some other conversions going on.

That's the original file (one of them, since they are 2 cropped and stitched side-by-side, the other one is the same, except for the size)
Video
ID : 0
Format : YUV
Codec ID : ULH0
Codec ID/Info : Ut Video Lossless Codec
Codec ID/Hint : Ut Video
Duration : 14 min 45 s
Bit rate : 780 Mb/s
Width : 1 920 pixels
Height : 1 200 pixels
Display aspect ratio : 16:10
Frame rate : 60.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Compression mode : Lossless
Bits/(Pixel*Frame) : 5.644
Stream size : 80.5 GiB (100%)

That's after Premiere:
Video
ID : 0
Format : YUV
Codec ID : ULH0
Codec ID/Info : Ut Video Lossless Codec
Codec ID/Hint : Ut Video
Duration : 14 min 37 s
Bit rate : 817 Mb/s
Width : 1 920 pixels
Height : 1 200 pixels
Display aspect ratio : 16:10
Frame rate : 60.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Compression mode : Lossless
Bits/(Pixel*Frame) : 5.908
Time code of first frame : 00:00:00:00 / 00:00:00:00
Time code source : Adobe tc_A / Adobe tc_O
Stream size : 83.5 GiB (100%)
The video is exported through Premiere directly in Ut Video.

P.S. I had to make a fresh install to latest Ut Video for Premiere to start working with it, and I had a message that some old version is installed (the version shows was something like 11.x.x and I had 17 or 18 just a bit earlier than the latest). OBS never said anything for the versions though, I assume it has it's own version somewhere in the program's files.

poisondeathray
31st July 2017, 19:12
422 to 420 shouldn't change colors or brightness or contrast. It's just subsampling the chroma, so maybe fine colored borders or text are bit more blurry but that's it. Less so since you started with 420. So I suspect those brightness / contrast issues are from premiere , or a display configuration issue. But it's still curious why you're getting 422=>420 warning when the fourcc says it's 420

Here is the part where it gets a bit crazy - different versions of PP treat UT slightly differently. None of them are treated as YUV. All of them get converted to RGB. I suspect part of the problem is a 601 vs. 709 mismatch. Either decoding on the timeline or converting back in AME (RGB back to YUV) is the stage where you're probably getting problems. ULH0 is the least compatible and has the most issues, it even has problems in ffmpeg

Spiderm@n
1st August 2017, 00:42
Problem is the output from Premiere is perfectly fine colored, but once it goes through x264 it gets the color problem. Both source for premiere and the output of it are in 709 (I specially checked the program configurations to use the same settings in both OBS and Premiere). And I check the colors on both in the same player (MPC-HC, though for x264 it uses the internal LAV filters, and for Ut uses the externally installed Ut codec, if that matters).

poisondeathray
1st August 2017, 03:43
Problem is the output from Premiere is perfectly fine colored, but once it goes through x264 it gets the color problem. Both source for premiere and the output of it are in 709 (I specially checked the program configurations to use the same settings in both OBS and Premiere). And I check the colors on both in the same player (MPC-HC, though for x264 it uses the internal LAV filters, and for Ut uses the externally installed Ut codec, if that matters).

What does Info() say about your script?

AVISource()
Info()


Can you post more info ?

Specifically ,

1) your avs script
2) x264 commandline
3) small sample of your source (e.g. vdub, cut with direct stream copy)

Spiderm@n
1st August 2017, 13:11
Info: https://1drv.ms/i/s!Am76j9YJFH_owMQ1oPeD1v4OJTdsUA

Sample: https://1drv.ms/v/s!Am76j9YJFH_owMQ2-vBmBe2jo2la0A (It'll try to play it, but will fail, can be downloaded though)

I'm not actually using avs script, I'm sending the .avi file directly, however x264 tries to open it (and succeeds) with avs, using AVISource(), and my avs script that I also tried was AVISource() and nothing more.

the command line is like: --crf 20 --preset veryslow --tune animation --thread-input

may be animation is not the best option but.....

sneaker_ger
1st August 2017, 14:04
Did you already try ffvideosource()?
?????

Spiderm@n
1st August 2017, 14:06
I don't have ffdshow filters installed, I'm not sure that even the LAV filters I have are working since I use the build in MPC, also ff was really crappy some time back, when I last used it and honestly prefer not to use it at all.

sneaker_ger
1st August 2017, 14:12
I'm not talking about ffdshow or LAV Filters. I'm talking about the ffms2 AviSynth plugin (https://github.com/FFMS/ffms2/releases). Copy the .dll to the AviSynth plugin folder (or load manually) and write a script like:
ffvideosource("Sequence01part.avi")

Spiderm@n
1st August 2017, 14:35
https://1drv.ms/i/s!Am76j9YJFH_owMQ3uqh8E3BPN6NDYg

Now there wasn't an unwanted change in color space. I encoded that 2 sec sample in both ways (with info) and they look kind of the same now, but weren't yesterday. (guess OBS can't properly capture the all colors though, or may be should put it on full range, where the videos look kind of dark).

sample FF: https://1drv.ms/u/s!Am76j9YJFH_owMQ5NCXEdVF7nB5g2A
sample AVIsource: https://1drv.ms/u/s!Am76j9YJFH_owMQ4EFtW0YzuoLYm6w

Spiderm@n
1st August 2017, 17:50
There's another problem though.
I can encode the part with ffvideosource, but once I put the 85GB full clip it's stuck, or at least nothing happens for few minutes.

sneaker_ger
1st August 2017, 18:02
ffvideosource() needs to index the complete file. The bigger the file the longer it takes.

Gser
1st August 2017, 20:35
You need to set Avisource(pixel_type="YV12") otherwise this happens.

Spiderm@n
3rd August 2017, 01:31
It worked and it looks good, thank you all guys, for the help.