[FFmpeg-devel] [PATCH] avformat/movenc: fix VVC encoding with leading pictures

Gabriel Hege g+ffmpeg at hege.cc
Fri May 16 14:05:01 EEST 2025


This is a resubmission with a corrected commit message.


The default behavior for VVenC (since v1.10.0) is to create an IDR with
leading pictures for the first picture in decoding order (POC 32). This
leads to FFmpeg generating an edit list with an empty entry, skipping
the leading pictures.

This patch fixes the calculation for the start_pts, while the DTS is
negative (as produced by libvvenc).


How to reproduce the issue (needs --enable-libvvenc and a recent 
libvvenc, e.g. v1.13):

Encode VVC directly into MP4 container:
./ffmpeg -i /data/YUV/foreman_352x288_30Hz_i420_8.y4m -an -preset faster 
-vcodec vvc test.mp4

   -> encodes 300 frames.

Decode to YUV (or play back using ffplay):
./ffmpeg -i test.mp4 test.yuv

   -> outputs 271 frames

When dumping the mp4-structure using 'MP4Box -diso test.mp4', I see the 
following EditListBox, which skips the first couple of 
frames:<EditListBox Size="40" Type="elst" Version="0" Flags="0" 
Specification="p12" Container="edts" EntryCount="2">
<EditListEntry Duration="1033" MediaTime="-1" MediaRate="1"/>
<EditListEntry Duration="8967" MediaTime="18432" MediaRate="1"/>
</EditListBox>


With the fix applied 300 frames are decoded as expected and the 
EditListBox looks like this:
<EditListBox Size="28" Type="elst" Version="0" Flags="0" 
Specification="p12" Container="edts" EntryCount="1">
<EditListEntry Duration="10000" MediaTime="2560" MediaRate="1"/>
</EditListBox>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avformat-movenc-fix-VVC-encoding-with-leading-pictur.patch
Type: text/x-patch
Size: 1852 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250516/31533b77/attachment.bin>


More information about the ffmpeg-devel mailing list