Hi all,

While working on a Kdenlive rendering issue, I noticed that the avformat consumer duplicates the last frame on encoding. So the resulting file is 1 frame longer than wanted.

This is easily reproducible with:

melt color:red out=10 -consumer avformat:red.mp4

This produces a 12 frames video, instead of 11 (0 - 10 range).

You can notice the frame duplication using the count producer:

melt count style=frames out=10 -consumer avformat:count.mp4

Results in a 12 frames long video with last video frame repeated twice.


After some tests, I can give the following details:

This only happens when encoding audio, so is related to the handling of audio data.

rendering with an=1 (to disable audio) gives a correct length file.


After more tests, I traced back the regressions to this commit (1) from may 2018 (!), switching to the newer FFmpeg api using avcodec_send_frame()/avcodec_receive_packet.

Commenting out the code flushing audio data :

https://github.com/mltframework/mlt/blob/master/src/modules/avformat/consumer_avformat.c#L2184

Seems to fixes the problem, but I am not sure it's the correct solution.

So if anyone has a hint on how to correctly fix this, help is welcome.

Best regards,

Jean-Baptiste


(1) https://github.com/mltframework/mlt/commit/1937704936a6569f181b7295fb8bafd223d13d66#diff-1bba886ccf70d0171adb4e7842ec3d58



_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to