View Full Version : Is this correct?
Alexkral
14th October 2019, 19:25
Hi, can someone please confirm if this is correct?:
Clip = FFmpegSource2("YV12.mkv")
Y = ExtractY(clip)
U = ExtractU(clip).LanczosResize(clip.Width, clip.Height)
V = ExtractV(clip).LanczosResize(clip.Width, clip.Height)
CombinePlanes(Y, U, V, planes = "YUV", source_planes = "YYY", pixel_type = "YV24")
And the same for YV16, YUY2, YV411, YUV420...
I ask mostly because of the ChromaInPlacement parameter in Convert. Maybe this way is correct for all formats (MPEG1, MPEG2, DV)?
Alexkral
16th October 2019, 02:38
I'll put it in a different way. For progressive YV12 to YV24 how wrong is it to use the default ChromaInPlacement with MPEG1 or DV?
I am writing a function for an AVSI and I don't want to add unnecessary arguments.
Asmodian
24th October 2019, 04:56
You always need to deal with chroma placement. Sorry, no way to avoid it if you want undamaged video when you are done.
Alexkral
25th October 2019, 20:06
That's right, but there's still something I don't understand here. The result of these two scripts is the same:
FFmpegSource2("YV24.mkv")
ConvertToYV12(ChromaOutPlacement = "MPEG2")
ConvertToYV24(ChromaInPlacement = "MPEG2", chromaresample = "Lanczos")
------------------------
FFmpegSource2("YV24.mkv")
ConvertToYV12(ChromaOutPlacement = "MPEG2")
Y = ExtractY(last)
U = ExtractU(last).LanczosResize(last.Width, last.Height, 0.25, 0, last.Width / 2, last.Height / 2)
V = ExtractV(last).LanczosResize(last.Width, last.Height, 0.25, 0, last.Width / 2, last.Height / 2)
CombinePlanes(Y, U, V, planes = "YUV", source_planes = "YYY", pixel_type = "YV24")
And the same goes for these two:
FFmpegSource2("YV24.mkv")
ConvertToYV12(ChromaOutPlacement = "MPEG1")
ConvertToYV24(ChromaInPlacement = "MPEG1", chromaresample = "Lanczos")
------------------------
FFmpegSource2("YV24.mkv")
ConvertToYV12(ChromaOutPlacement = "MPEG1")
Y = ExtractY(last)
U = ExtractU(last).LanczosResize(last.Width, last.Height, 0, 0, last.Width / 2, last.Height / 2)
V = ExtractV(last).LanczosResize(last.Width, last.Height, 0, 0, last.Width / 2, last.Height / 2)
CombinePlanes(Y, U, V, planes = "YUV", source_planes = "YYY", pixel_type = "YV24")
I think it should be the other way arround, it's MPEG1 which doesn't have the luma and chroma samples aligned, so there's a need to move the chroma, while MPEG2 does have them aligned and should not need it. :confused:
Gavino
26th October 2019, 16:30
Avisynth resizers resize around the image centre, not the top-left (or any other) corner.
So MPEG2 chroma, although originally aligned, gets shifted away on expansion while MPEG1 moves to the desired alignment.
Alexkral
27th October 2019, 05:52
Ahh ok thanks, that would also explain the vertical alignment, but I'd still have a couple of questions:
1 - I understand that the different behavior of chromaresample is because of the ChromaInPlacement argument, and what you said about the resizers doesn't apply here, right?
2 - Shouldn't be then the MPEG2 chroma shift in the second script to the right instead of to the left?
3 - Is this the same happening here (https://github.com/AviSynth/AviSynthPlus/issues/48)?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.