gpac / gpac

GPAC Ultramedia OSS for Video Streaming & Next-Gen Multimedia Transcoding, Packaging & Delivery
https://gpac.io
GNU Lesser General Public License v2.1
2.81k stars 536 forks source link

Regression: Wrong CompositionOffset for VVC IDR with leading pictures #2557

Closed K-os closed 1 year ago

K-os commented 1 year ago

A similar issue to #1913 has been reintroduced in commit 796bb9e5e. When packaging a VVC bitstream, that contains IDRs with leading pictures, the CompositionOffset and thus the resulting CTS is calculated wrongly. CRAs with leading pictures seem to be fine.

I uploaded a raw bitstream (foreman.266) and resulting mp4 file (foreman.mp4) to the Mediafire share.

This is the command line for creating the MP4 file: ~/src/gpac/_build/bin/gcc/MP4Box -new foreman.mp4 -add foreman.266:fps=30 and an excerpt from the -diso dump:

<CompositionOffsetBox Size="2416" Type="ctts" Version="0" Flags="0" Specification="p12" Container="stbl" EntryCount="300">
<CompositionOffsetEntry CompositionOffset="5" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="36" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="19" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="10" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="5" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="0" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="1" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="1" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="6" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="1" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="4" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="11" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="6" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="1" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="4" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="7" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="4" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="5" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="4" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="5" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="52" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="43" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="38" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="35" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="33" SampleCount="1"/>
...

but the correct entries should be:

<CompositionOffsetBox Size="2416" Type="ctts" Version="0" Flags="0" Specification="p12" Container="stbl" EntryCount="300">
<CompositionOffsetEntry CompositionOffset="5" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="36" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="19" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="10" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="5" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="0" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="1" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="1" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="6" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="1" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="4" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="11" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="6" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="1" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="4" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="7" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="4" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="5" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="3" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="4" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="36" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="19" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="10" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="5" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="2" SampleCount="1"/>
<CompositionOffsetEntry CompositionOffset="0" SampleCount="1"/>
...
jeanlf commented 1 year ago

indeed, now fixed - thanks for the report and faulty commit tracking !