I have two 1920x1080 PNG files, center.png and right.png, which are identical except that the image in right.png
is shifted horizontally by 325 pixels.
With mlt XML, I made a two-second long video using the lossless FFV1 format, showing one second of center.png
, and then one second of right.png
. Here's my file, foo.mlt
:
<?xml version='1.0' encoding='utf-8'?>
<mlt>
<profile width="1920" height="1080"
display_aspect_num="1920" display_aspect_den="1080"
sample_aspect_num="1" sample_aspect_den="1"
colorspace="709" progressive="1"
frame_rate_num="30" frame_rate_den="1"/>
<consumer mlt_service="avformat" properties="lossless/FFV1" target="out.mkv"/>
<producer id="center" mlt_service="qimage" resource="center.png" length="30"/>
<producer id="right" mlt_service="qimage" resource="right.png" length="30"/>
<playlist>
<entry producer="center"/>
<entry producer="right"/>
</playlist>
</mlt>
Then I run melt foo.mlt
at the terminal and check the output file out.mkv
in my video viewer. However, on close inspection, when right.png
appears in the video, it is slightly distorted (with some sort of halo-type artifact). Here is a magnified view:
Weirdly, only the right.png
image is distorted; the center.png
displays correctly, even though the two images are identical except for positioning.
Is this a bug? I wouldn't expect any image distortion with a lossless codec, but maybe I've done something wrong.
My specs:
Ubuntu 20.04.2 LTS, 64-bit
melt 6.25.0
ffmpeg version 4.2.4-1ubuntu0.1
Thanks
"Lossless" is not always lossless. In the case of "lossless/FFV1", the chroma format is 4:2:2 which will cut the chroma resolution in half: https://github.com/mltframework/mlt/blob/master/presets/consumer/avformat/lossless/FFV1 This could be relevant because if format conversion is required, it could cause chroma bleeding on pixels that do not land directly on a chroma sample.
As an experiment, you could try shifting the image by 326 pixels instead of 325 to see if the bleeding still occurs.
There was another question a while back that related to bleeding due to chroma subsampling: Melt composite transition is slightly blending