[FFmpeg-devel] [PATCH 1/2] avformat/mov: ensure the IAMF track is the first

Anton Khirnov anton at khirnov.net
Thu Aug 1 11:59:01 EEST 2024


Quoting James Almer (2024-08-01 04:14:09)
> Fixes crashes when muxing video tracks alongside IAMF ones.
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavformat/movenc.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index ae49582a1a..87ec368d52 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -7536,6 +7536,7 @@ static int mov_init_iamf_track(AVFormatContext *s)
>      if (!track->iamf)
>          return AVERROR(ENOMEM);
>  
> +    track->first_iamf_idx = INT_MAX;
>      for (int i = 0; i < s->nb_stream_groups; i++) {
>          const AVStreamGroup *stg = s->stream_groups[i];
>          switch(stg->type) {
> @@ -7558,6 +7559,11 @@ static int mov_init_iamf_track(AVFormatContext *s)
>              return ret;
>      }
>  
> +    if (track->first_iamf_idx != 0) {
> +        av_log(s, AV_LOG_ERROR, "The IMAF track must be the first track\n");

Why? And is this documented anywhere?

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list