mltframework / shotcut

cross-platform (Qt), open-source (GPLv3) video editor
https://www.shotcut.org
GNU General Public License v3.0
10.84k stars 1.12k forks source link

Interlaced video incorrectly handled #1422

Closed Sharc99 closed 1 year ago

Sharc99 commented 1 year ago

Rendering of interlaced video sources of format YV12 (4:2:0) or YV16 (4:2:2) to interlaced YV12 (4:2:0) using libx264 is flawed. There is significant chroma crosstalk/contamination between the fields, The functionality is essential for rendering captured interlaced VHS sources to interlaced YV12 h.264 video, for example. Setting the source file properties manually does not help / has no effect. Windows11, all Shotcut versions, including 22.12.21.

ddennedy commented 1 year ago

This was already fixed for the next version for which there is a beta that you can test.

Sharc99 commented 1 year ago

Thanks. Will test soon. Shotcut is really great.

Sharc99 commented 1 year ago

I made some test with beta 23.04.03.

bmatherly commented 1 year ago

I am willing to look into this if you can provide some test clips and instructions to reproduce.

Sharc99 commented 1 year ago

Thank you for your kind offer. I stand corrected. The conversion works correctly for 4:2:2 and 4:2:0 sources with the latest Beta, so this is solved, thanks. I am just not sure whether the Preview and Sopes->Video Zoom show the scanlines and colors right for 4:2:2 .avi sources. I attach a testfile. The source properties have to be set manually to interlaced, top field first as the .avi does not provide the corresponding signalling. Export is h264 interlaced TFF which works correctly with the latest Beta., The fields of the h264 encode can be cleanly separated again as a test. So the main issue (chroma mingling between fields) of the previous version got solved. 0) 422i_.zip

bmatherly commented 1 year ago

I am just not sure whether the Preview and Sopes->Video Zoom show the scanlines and colors right for 4:2:2 .avi sources.

Make sure you uncheck "progressive" in the player settings.

image

The player always operates in 4:2:0. And the video zoom scope takes its values from the player. So the chroma samples will always be shared between 4 pixels in a box.

So if your source is 4:2:2, you will see some chroma bleeding in the preview/zoom scope.

Sharc99 commented 1 year ago

The player always operates in 4:2:0. And the video zoom scope takes its values from the player. So the chroma samples will always be shared between 4 pixels in a box.

So if your source is 4:2:2, you will see some chroma bleeding in the preview/zoom scope.

This explains it. Thank you

Sharc99 commented 1 year ago

There is another similar issue I like to report: The latest Beta of Shotcut processes interlaced 4:2:2 and interlaced 4:2:0 sources correctly, as discussed. However, when opening a virtual 4:2:0 interlaced .avi from the AVFS (Avisynth Virtual File System) the chroma is mingled between the fields as before. I am using the AVFS for opening Avisynth scripts (.avs) in Shotcut, because Shotcut cannot read Avisynth scripts directly. I am aware that this may be beyond the scope of Shotcut, but because the AVFS method works well with other video tools which do not directly read .avs scripts I thought I would bring this up as it may be I bug. Otherwise never mind.

ddennedy commented 1 year ago

That is not something in our control. It is somewhere between FFmpeg and AVFS.

Sharc99 commented 1 year ago

maybe, yes.