[FFmpeg-devel] [PATCH 2/2] avformat/movenc: parse h264 packets to build Sync Sample and Recovery Point tables

James Almer jamrial at gmail.com
Thu Jul 29 21:09:03 EEST 2021


On 7/29/2021 2:58 PM, Michael Niedermayer wrote:
> On Tue, Jul 27, 2021 at 10:08:20AM -0300, James Almer wrote:
>> Since we can't blindly trust the keyframe flag in packets and assume its
>> contents are a valid Sync Sample, do some basic bitstream parsing to build the
>> Sync Sample table in addition to a Random Access Recovery Point table.
>>
>> Suggested-by: ffmpeg at fb.com
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>   libavformat/movenc.c         | 125 +++++++++++++++++++++++++++++++++--
>>   libavformat/movenc.h         |   1 +
>>   tests/ref/lavf-fate/h264.mp4 |   6 +-
>>   3 files changed, 123 insertions(+), 9 deletions(-)
> 
> Will this allow a user to mark a subset of keyframes as random
> access points ?
> A user may want seeking to preferably happen to a scene start and not a
> frame before
> 
> Will this allow a user to mark a damaged keyframe as such ?
> A frame might in fact have been a keyframe and maybe the only in the file
> but maybe was damaged so a parser might fail to detect it.

This code will ensure all packets with an IDR picture will be listed in 
the Sync Sample table, and all packets with a Recovery Point SEI message 
will be listed in the Random Access Recovery Point table.
Whatever is signaled in packets (like the keyframe flag) is ignored to 
prevent creating non-spec compliant output.

> 
> Thanks
> 
> [...]
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 



More information about the ffmpeg-devel mailing list