Opened 13 days ago

Last modified 9 days ago

#11201 new defect

Atypical AVIF stream handling in FFmpeg 7: Misaligning major implementations

Reported by: nmp5 Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mov regression
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I can no longer convert animated AVIF to MP4 when using ffmpeg v7. It does convert, but the MP4 doesn't show the animation. Just the first frame or so.

While, with ffmpeg v6, it works well (animation shown perfectly in the MP4 file, and file size bigger than the MP4 file created by ffmpeg v7).

I tried this in Alpine docker, and on Windows.

In the attachments, I include:

  • the original AVIF file
  • the various logs for each of the commands I ran (with the command in the first line, for reference), with "-v trace"
  • the outputs produced (animated-avif-ffmpeg-6-apk.mp4 and animated-avif-ffmpeg-6-static.mp4 are the expected outputs)
  • the output of "ffmpeg -v 9 -loglevel 99 -i"

Attachments (4)

animated-avif-trace.zip (56.3 KB ) - added by nmp5 13 days ago.
animated-avif-trace-2.zip (23.8 KB ) - added by nmp5 12 days ago.
animated-avif-trace-3.zip (10.0 KB ) - added by nmp5 11 days ago.
animated-avif.avif (8.1 KB ) - added by MasterQuestionable 9 days ago.
͏    7.0.2: \\ Input !#0, mov,mp4,m4a,3gp,3g2,mj2, from 'animated-avif.avif':\\ ͏  Metadata:\\ ͏    major_brand     : avis\\ ͏    minor_version   : 0\\ ͏    compatible_brands: avifavismsf1iso8mif1miafMA1A\\ ͏    creation_time   : 2024-09-03T13:00:28.000000Z\\ ͏    comment         : AVIFS created with https://ezgif.com/avif-maker\\ ͏  Duration: 00:00:01.50, start: 0.000000, bitrate: 44 kb/s\\ ͏  Stream !#0:0[0x1], 1, 1/1: Video: av1 (libdav1d) (High), 1 reference frame (av01 / 0x31307661), yuv444p(pc, smpte170m/bt709/iec61966-2-1), 169x98 [SAR 1:1 DAR 169:98], 0/1, 1 fps, 1 tbr, 1 tbn (default)\\ ͏      Metadata:\\ ͏        title           : Color\\ ͏  Stream !#0:1[0x2], 1, 1/1: Video: av1 (libdav1d) (Main), 1 reference frame (av01 / 0x31307661), gray(pc), 169x98 [SAR 1:1 DAR 169:98], 0/1, 1 fps, 1 tbr, 1 tbn\\ ͏      Metadata:\\ ͏        title           : Alpha\\ ͏  Stream !#0:2[0x1](und), 10, 1/1000: Video: av1 (libdav1d) (High), 1 reference frame (av01 / 0x31307661), yuv444p(pc, smpte170m/bt709/iec61966-2-1), 169x98 [SAR 1:1 DAR 169:98], 0/1, 32 kb/s, 6.67 fps, 6.67 tbr, 1k tbn (default)\\ ͏      Metadata:\\ ͏        creation_time   : 2024-09-03T13:00:28.000000Z\\ ͏        handler_name    : libavif\\ ͏        vendor_id       : [0][0][0][0]\\ ͏        encoder         : AOM Coding\\ ͏  Stream !#0:3[0x2](und), 10, 1/1000: Video: av1 (libdav1d) (Main), 1 reference frame (av01 / 0x31307661), gray(pc), 169x98 [SAR 1:1 DAR 169:98], 0/1, 0 kb/s, 6.67 fps, 6.67 tbr, 1k tbn (default)\\ ͏      Metadata:\\ ͏        creation_time   : 2024-09-03T13:00:28.000000Z\\ ͏        handler_name    : libavif\\ ͏        vendor_id       : [0][0][0][0]\\ ͏        encoder         : AOM Coding\\ ͏    6.1.1: \\ Input !#0, mov,mp4,m4a,3gp,3g2,mj2, from 'animated-avif.avif':\\ ͏  Metadata:\\ ͏    major_brand     : avis\\ ͏    minor_version   : 0\\ ͏    compatible_brands: avifavismsf1iso8mif1miafMA1A\\ ͏    creation_time   : 2024-09-03T13:00:28.000000Z\\ ͏    comment         : AVIFS created with https://ezgif.com/avif-maker\\ ͏  Duration: 00:00:01.50, start: 0.000000, bitrate: 44 kb/s\\ ͏  Stream !#0:0[0x1](und), 1, 1/1000: Video: av1 (High), 1 reference frame (av01 / 0x31307661), yuv444p(pc, smpte170m/bt709/iec61966-2-1), 169x98 [SAR 1:1 DAR 169:98], 0/1, 32 kb/s, 6.67 fps, 6.67 tbr, 1k tbn (default)\\ ͏    Metadata:\\ ͏      creation_time   : 2024-09-03T13:00:28.000000Z\\ ͏      handler_name    : libavif\\ ͏      vendor_id       : [0][0][0][0]\\ ͏      encoder         : AOM Coding\\ ͏  Stream !#0:1[0x2](und), 7, 1/1000: Video: av1 (Main), 1 reference frame (av01 / 0x31307661), gray(pc), 169x98 [SAR 1:1 DAR 169:98], 0/1, 0 kb/s, 6.67 fps, 6.67 tbr, 1k tbn (default)\\ ͏    Metadata:\\ ͏      creation_time   : 2024-09-03T13:00:28.000000Z\\ ͏      handler_name    : libavif\\ ͏      vendor_id       : [0][0][0][0]\\ ͏      encoder         : AOM Coding\\

Download all attachments as: .zip

Change History (15)

by nmp5, 13 days ago

Attachment: animated-avif-trace.zip added

comment:1 by MasterQuestionable, 13 days ago

Cc: MasterQuestionable added
Component: undeterminedavcodec
Keywords: libdav1d added; avif removed
Summary: Animated AVIF converts well to mp4 in ffmpeg v6, but not in v7Animated AVIF decoding regression (7.0.2 ~ 6.1.1)
Version: unspecifiedgit-master

͏    See comment:10.

͏    ----

͏    Or maybe related with "avformat": try "-ignore_editlist 1"? (input option)

Last edited 9 days ago by MasterQuestionable (previous) (diff)

by nmp5, 12 days ago

Attachment: animated-avif-trace-2.zip added

comment:2 by nmp5, 12 days ago

Hello. I tried adding "-ignore_editlist 1" before "-v trace", using ffmpeg v7, but the output was still the same.

However, if I add "-map 0:2", it works. This is because ffmpeg 7 for some reason demuxes the input file into 4 streams, while ffmpeg 6 wasn't.

(I had originally opened this issue here - https://github.com/wader/static-ffmpeg/issues/530 - and the owner of the repo noticed the "demuxing" difference.)

Is this intentional behavior?
If so, how can I make the command figure out what stream to select so it selects the correct one? (to get the behavior of ffmpeg 6)

I attached 4 more files. The "map02.mp4" one is the expected output (but with "-map 0:2" hardcoded in the command).

Thank you.

comment:3 by MasterQuestionable, 12 days ago

Component: avcodecavformat
Keywords: mov added

͏    Input option is to be placed before "-i".
͏    You applied "-ignore_editlist" as output; and for this case it would be silent no-op...
͏    https://trac.ffmpeg.org/ticket/11030#comment:5


͏    Probably of "avformat" cause:
͏    https://github.com/FFmpeg/FFmpeg/commit/41e349c24a726d0c3bac5830eec9f6940ea41c63

͏    I don't use AVIF, so pardon my limited understanding.
͏    But generally, such multi-primary-stream medias tend to be problematic in current implementations.
͏    (container inaptness)

͏    Caveat that metadata may play a factor in such cases.
͏    (you used "-map_metadata -1": that unmaps most metadata)

by nmp5, 11 days ago

Attachment: animated-avif-trace-3.zip added

comment:4 by nmp5, 11 days ago

Hello. Thank you. I added another attachment with the result with "-ignore_editlist 1" before "-i", and without "-map_metadata -1". Still not working.

comment:5 by MasterQuestionable, 9 days ago

͏    Thanks for your feedback.
͏    I wonder, what material is it in each of these streams..?
͏    As it seems, you expected only 1 of the all?

comment:6 by nmp5, 9 days ago

Thank you. I don't understand the question. What do you mean "material"?

I really just expect it to behave the same way as in ffmpeg v6, where the output contains all the frames of the animated image :)

by MasterQuestionable, 9 days ago

Attachment: animated-avif.avif added

͏    7.0.2:
[[
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'animated-avif.avif':
͏  Metadata:
͏    major_brand     : avis
͏    minor_version   : 0
͏    compatible_brands: avifavismsf1iso8mif1miafMA1A
͏    creation_time   : 2024-09-03T13:00:28.000000Z
͏    comment         : AVIFS created with https://ezgif.com/avif-maker
͏  Duration: 00:00:01.50, start: 0.000000, bitrate: 44 kb/s
͏  Stream #0:0[0x1], 1, 1/1: Video: av1 (libdav1d) (High), 1 reference frame (av01 / 0x31307661), yuv444p(pc, smpte170m/bt709/iec61966-2-1), 169x98 [SAR 1:1 DAR 169:98], 0/1, 1 fps, 1 tbr, 1 tbn (default)
͏      Metadata:
͏        title           : Color
͏  Stream #0:1[0x2], 1, 1/1: Video: av1 (libdav1d) (Main), 1 reference frame (av01 / 0x31307661), gray(pc), 169x98 [SAR 1:1 DAR 169:98], 0/1, 1 fps, 1 tbr, 1 tbn
͏      Metadata:
͏        title           : Alpha
͏  Stream #0:2[0x1](und), 10, 1/1000: Video: av1 (libdav1d) (High), 1 reference frame (av01 / 0x31307661), yuv444p(pc, smpte170m/bt709/iec61966-2-1), 169x98 [SAR 1:1 DAR 169:98], 0/1, 32 kb/s, 6.67 fps, 6.67 tbr, 1k tbn (default)
͏      Metadata:
͏        creation_time   : 2024-09-03T13:00:28.000000Z
͏        handler_name    : libavif
͏        vendor_id       : [0][0][0][0]
͏        encoder         : AOM Coding
͏  Stream #0:3[0x2](und), 10, 1/1000: Video: av1 (libdav1d) (Main), 1 reference frame (av01 / 0x31307661), gray(pc), 169x98 [SAR 1:1 DAR 169:98], 0/1, 0 kb/s, 6.67 fps, 6.67 tbr, 1k tbn (default)
͏      Metadata:
͏        creation_time   : 2024-09-03T13:00:28.000000Z
͏        handler_name    : libavif
͏        vendor_id       : [0][0][0][0]
͏        encoder         : AOM Coding
]]
͏    6.1.1:
[[
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'animated-avif.avif':
͏  Metadata:
͏    major_brand     : avis
͏    minor_version   : 0
͏    compatible_brands: avifavismsf1iso8mif1miafMA1A
͏    creation_time   : 2024-09-03T13:00:28.000000Z
͏    comment         : AVIFS created with https://ezgif.com/avif-maker
͏  Duration: 00:00:01.50, start: 0.000000, bitrate: 44 kb/s
͏  Stream #0:0[0x1](und), 1, 1/1000: Video: av1 (High), 1 reference frame (av01 / 0x31307661), yuv444p(pc, smpte170m/bt709/iec61966-2-1), 169x98 [SAR 1:1 DAR 169:98], 0/1, 32 kb/s, 6.67 fps, 6.67 tbr, 1k tbn (default)
͏    Metadata:
͏      creation_time   : 2024-09-03T13:00:28.000000Z
͏      handler_name    : libavif
͏      vendor_id       : [0][0][0][0]
͏      encoder         : AOM Coding
͏  Stream #0:1[0x2](und), 7, 1/1000: Video: av1 (Main), 1 reference frame (av01 / 0x31307661), gray(pc), 169x98 [SAR 1:1 DAR 169:98], 0/1, 0 kb/s, 6.67 fps, 6.67 tbr, 1k tbn (default)
͏    Metadata:
͏      creation_time   : 2024-09-03T13:00:28.000000Z
͏      handler_name    : libavif
͏      vendor_id       : [0][0][0][0]
͏      encoder         : AOM Coding
]]

comment:7 by MasterQuestionable, 9 days ago

Keywords: libdav1d removed

͏    Probably related how EzGIF processes the files?
͏    Your claimed "all frames" actually only contain part of the frames:
͏    Which means the file itself contained materials no-use for you.

͏    Alike: https://trac.ffmpeg.org/ticket/8338#comment:20

Last edited 9 days ago by MasterQuestionable (previous) (diff)

comment:8 by nmp5, 9 days ago

Maybe. I'm not really an expert in animated image files or videos. What I'm saying is that with ffmpeg v6 I got a video that showed the same animation as in the AVIF file, while with ffmpeg v7, I didn't. Thanks.

comment:9 by MasterQuestionable, 9 days ago

Summary: Animated AVIF decoding regression (7.0.2 ~ 6.1.1)Animated AVIF decoding regression (7.0.2 ~ 6.1.1): Unexpected extra streams

comment:10 by MasterQuestionable, 9 days ago

Summary: Animated AVIF decoding regression (7.0.2 ~ 6.1.1): Unexpected extra streamsAnimated AVIF demuxing regression (7.0.2 ~ 6.1.1): Unexpected extra streams

͏    Note: AVIF appears to be some variant of MP4.

comment:11 by MasterQuestionable, 9 days ago

Keywords: regression added
Summary: Animated AVIF demuxing regression (7.0.2 ~ 6.1.1): Unexpected extra streamsAtypical AVIF stream handling in FFmpeg 7: Misaligning major implementations
Note: See TracTickets for help on using tickets.