[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 03:39:17 EEST 2021


On 7/28/2021 7:51 PM, Derek Buitenhuis wrote:
> On 7/27/2021 2:08 PM, 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(-)
> 
> This problem (due to insufficient API) exists for a lot more codecs
> than H.264 - are we going to fill movenc.c with parsers for HEVC,
> AV1, MPEG-4 ASP, etc., or just make only on codec behave this way?

It's not a problem for AV1 (we correctly tag all packets that should be 
sync samples).

I'm not going to bother with HEVC right now, but this all can be 
simplified once we introduce a new parser API that exposes the important 
per-codec bitstream values, CBS-style (and for example based on it), 
that can be used by muxers, instead of relying purely on values present 
in packets as exported by either a demuxer (from container info or 
derived from auto inserted AVCodecParserContext in utils.c) or just made 
up by the library user.

> 
> - Derek
> _______________________________________________
> 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