[FFmpeg-devel] [PATCH] Set AVSTREAM_PARSE_HEADERS flag for AV1 MP4 streams.

James Almer jamrial at gmail.com
Wed Aug 19 18:29:05 EEST 2020


On 8/19/2020 6:50 AM, ManojGuptaBonda wrote:
> From: Vikas Agarwal <vikasa at nvidia.com>
> 
> It allow AV1 header parsing and help initialize chroma format and other
> info properly.
> 
> Chroma format wasn't correct if we use below code:
> 
> avformat_find_stream_info(fmtc, NULL); iVideoStream =
> av_find_best_stream(fmtc, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
> eChromaFormat = (AVPixelFormat)fmtc->streams[iVideoStream]->codecpar->
>  format;
> ---
>  libavformat/mov.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 1532e74d67..4d4b5c0f48 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -7615,6 +7615,8 @@ static int mov_read_header(AVFormatContext *s)
>              av_log(s, AV_LOG_VERBOSE, "Forcing full parsing for mp3 stream\n");
>              st->need_parsing = AVSTREAM_PARSE_FULL;
>          }
> +        if (st->codecpar->codec_id == AV_CODEC_ID_AV1)
> +            st->need_parsing = AVSTREAM_PARSE_HEADERS;

Could you add this at the end of mov_finalize_stsd_codec() instead?

>      }
>  
>      if (mov->trex_data) {
> 



More information about the ffmpeg-devel mailing list