Opened 15 months ago

Closed 14 months ago

Last modified 14 months ago

#11553 closed defect (fixed)

Suboptimal logic in "ffmpeg_dec.c" may glitch abnormal VP9 decoding

Reported by: jasper Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: ffmpeg_dec
Cc: jasper, MasterQuestionable Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug:
I got my hands on an MP4 file that, when played via MPV, works fine for the first 2 minutes. But afterwards, it complains about "[ffmpeg/video] vp9: Marker bit was set". So I tried to see if re-encoding might fix it, but at the same 2:00 timestamp, an internal bug is triggered.

I currently can't upload the file because when resizing it to 2.5 MB, it only includes the first 38 seconds.
How to reproduce:

% ffmpeg -report  -v 9 -loglevel 99 -i corrupted.mp4 out.mp4
ffmpeg started on 2025-04-24 at 15:04:43
Report written to "ffmpeg-20250424-150443.log"
Log level: 99
Command line:
./ffmpeg -report -v 9 -loglevel 99 -i corrupted.mp4 out.mp4
ffmpeg version N-119343-g25b0a8e295 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 14.2.1 (GCC) 20250207
  configuration: --extra-cflags=-I/opt/local/include --extra-ldflags=-L/opt/local/lib --enable-gpl --enable-version3 --enable-nonfree --enable-libvpx --enable-libvorbis
  libavutil      60.  2.100 / 60.  2.100
  libavcodec     62.  0.101 / 62.  0.101
  libavformat    62.  0.100 / 62.  0.100
  libavdevice    62.  0.100 / 62.  0.100
  libavfilter    11.  0.100 / 11.  0.100
  libswscale      9.  0.100 /  9.  0.100
  libswresample   6.  0.100 /  6.  0.100
  libpostproc    59.  1.100 / 59.  1.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input url with argument 'corrupted.mp4'.
Reading option 'out.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option v (set logging level) with argument 9.
Applying option loglevel (set logging level) with argument 99.
Successfully parsed a group of options.
Parsing a group of options: input url corrupted.mp4.
Successfully parsed a group of options.
Opening an input file: corrupted.mp4.
[AVFormatContext @ 0x56bc7babab80] Opening 'corrupted.mp4' for reading
[file @ 0x56bc7babb140] Setting default whitelist 'file,crypto,data'
Probing mov,mp4,m4a,3gp,3g2,mj2 score:100 size:2048
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'ftyp' parent:'root' sz: 36 8 61619370
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] ISO: File Type Major Brand: iso6
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'free' parent:'root' sz: 73 44 61619370
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'moov' parent:'root' sz: 1700 117 61619370
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'mvhd' parent:'moov' sz: 108 8 1692
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] time scale = 24000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'trak' parent:'moov' sz: 698 116 1692
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'tkhd' parent:'trak' sz: 92 8 690
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'mdia' parent:'trak' sz: 598 100 690
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'mdhd' parent:'mdia' sz: 32 8 590
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'hdlr' parent:'mdia' sz: 70 40 590
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] ctype=[0][0][0][0]
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stype=vide
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'minf' parent:'mdia' sz: 488 110 590
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'vmhd' parent:'minf' sz: 20 8 480
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'dinf' parent:'minf' sz: 36 28 480
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'dref' parent:'dinf' sz: 28 8 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'stbl' parent:'minf' sz: 424 64 480
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'stsd' parent:'stbl' sz: 348 8 416
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] size=206 4CC=encv codec_type=0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'vpcC' parent:'stsd' sz: 20 8 120
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'sinf' parent:'stsd' sz: 80 28 120
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'frma' parent:'sinf' sz: 12 8 72
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'schm' parent:'sinf' sz: 20 20 72
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'schi' parent:'sinf' sz: 40 40 72
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'tenc' parent:'schi' sz: 32 8 32
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'btrt' parent:'stsd' sz: 20 108 120
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] size=126 4CC=vp09 codec_type=0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'vpcC' parent:'stsd' sz: 20 8 40
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'btrt' parent:'stsd' sz: 20 28 40
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'stts' parent:'stbl' sz: 16 356 416
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] track[0].stts.entries = 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'stsc' parent:'stbl' sz: 16 372 416
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] track[0].stsc.entries = 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'stsz' parent:'stbl' sz: 20 388 416
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] sample_size = 0 sample_count = 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'stco' parent:'stbl' sz: 16 408 416
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] advanced_editlist does not work with fragmented MP4. disabling.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'mvex' parent:'moov' sz: 56 814 1692
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'mehd' parent:'mvex' sz: 16 8 48
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'trex' parent:'mvex' sz: 32 24 48
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'pssh' parent:'moov' sz: 76 870 1692
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'pssh' parent:'moov' sz: 702 946 1692
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'pssh' parent:'moov' sz: 52 1648 1692
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'sidx' parent:'root' sz: 5012 1817 61619370
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'ssix' parent:'root' sz: 4996 6829 61619370
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'moof' parent:'root' sz: 257 11825 61619370
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] moof offset 2e29
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'mfhd' parent:'moof' sz: 16 8 249
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'traf' parent:'moof' sz: 233 24 249
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'tfhd' parent:'traf' sz: 28 8 225
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] frag flags 0x1010000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'tfdt' parent:'traf' sz: 16 36 225
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'trun' parent:'traf' sz: 140 52 225
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] flags 0x205 entries 29
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] found tfdt time 0, using it for dts
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] first sample flags 0x0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 1, offset 2f32, dts 0, size 100, distance 0, keyframe 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 2, offset 2f96, dts 1001, size 77, distance 1, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 3, offset 2fe3, dts 2002, size 34, distance 2, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 4, offset 3005, dts 3003, size 30, distance 3, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 5, offset 3023, dts 4004, size 27, distance 4, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 6, offset 303e, dts 5005, size 25, distance 5, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 7, offset 3057, dts 6006, size 23, distance 6, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 8, offset 306e, dts 7007, size 23, distance 7, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 9, offset 3085, dts 8008, size 23, distance 8, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 10, offset 309c, dts 9009, size 23, distance 9, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 11, offset 30b3, dts 10010, size 24, distance 10, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 12, offset 30cb, dts 11011, size 23, distance 11, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 13, offset 30e2, dts 12012, size 23, distance 12, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 14, offset 30f9, dts 13013, size 23, distance 13, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 15, offset 3110, dts 14014, size 23, distance 14, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 16, offset 3127, dts 15015, size 23, distance 15, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 17, offset 313e, dts 16016, size 34, distance 16, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 18, offset 3160, dts 17017, size 202, distance 17, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 19, offset 322a, dts 18018, size 23, distance 18, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 20, offset 3241, dts 19019, size 23, distance 19, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 21, offset 3258, dts 20020, size 23, distance 20, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 22, offset 326f, dts 21021, size 23, distance 21, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 23, offset 3286, dts 22022, size 23, distance 22, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 24, offset 329d, dts 23023, size 23, distance 23, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 25, offset 32b4, dts 24024, size 23, distance 24, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 26, offset 32cb, dts 25025, size 23, distance 25, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 27, offset 32e2, dts 26026, size 23, distance 26, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 28, offset 32f9, dts 27027, size 29, distance 27, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 29, offset 3316, dts 28028, size 33, distance 28, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'sdtp' parent:'traf' sz: 41 192 225
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] track[0].sdtp.entries = 29
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'mdat' parent:'root' sz: 1037 12082 61619370
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] on_parse_exit_offset=12082
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] Before avformat_find_stream_info() pos: 12082 bytes read:32768 seeks:0 nb_streams:1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 0, dts 0
[vp9 @ 0x56bc7babd3c0] Format yuv420p chosen by get_format().
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 1, dts 41708
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2, dts 83417
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 3, dts 125125
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 4, dts 166833
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 5, dts 208542
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 6, dts 250250
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 7, dts 291958
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 8, dts 333667
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 9, dts 375375
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 10, dts 417083
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 11, dts 458792
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 12, dts 500500
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 13, dts 542208
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 14, dts 583917
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 15, dts 625625
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 16, dts 667333
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 17, dts 709042
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 18, dts 750750
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 19, dts 792458
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 20, dts 834167
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0: start_time: 0 duration: 1436.059625
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] format: start_time: 0 duration: 1436.059625 (estimate from stream) bitrate=343 kb/s
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] After avformat_find_stream_info() pos: 12911 bytes read:32768 seeks:0 frames:21
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'corrupted.mp4':
  Metadata:
    major_brand     : iso6
    minor_version   : 1
    compatible_brands: mcl0iso6dsmsmsixdash
    creation_time   : 2023-08-27T19:03:56.000000Z
  Duration: 00:23:56.06, start: 0.000000, bitrate: 343 kb/s
  Stream #0:0[0x1](und), 21, 1/24000: Video: vp9 (Profile 0), 1 reference frame (vp09 / 0x39307076), yuv420p(tv, bt709), 960x540, 0/1, 6 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2023-08-27T19:03:54.000000Z
      handler_name    : ?@GPAC2.3-DEV-rev7249-gb5923a16f-HEAD
      vendor_id       : [0][0][0][0]
      encoder         : VPC Coding
    Side data:
      unknown side data type 24 (834 bytes)
Successfully opened the file.
Parsing a group of options: output url out.mp4.
Successfully parsed a group of options.
Opening an output file: out.mp4.
[out#0/mp4 @ 0x56bc7bb0fb40] No explicit maps, mapping streams automatically...
[vost#0:0/mpeg4 @ 0x56bc7bb10000] Created video stream from input stream 0:0
detected 8 logical cores
[file @ 0x56bc7bb0b740] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (vp9 (native) -> mpeg4 (native))
[vost#0:0/mpeg4 @ 0x56bc7bb10000] Starting thread...
[vf#0:0 @ 0x56bc7baefd00] Starting thread...
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Starting thread...
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7baba8c0] Starting thread...
Press [q] to stop, [?] for help
[vp9 @ 0x56bc7bb11a40] Format yuv420p chosen by get_format().
[graph -1 input from stream 0:0 @ 0x742aec0024c0] w:960 h:540 pixfmt:yuv420p tb:1/24000 fr:24000/1001 sar:0/1 csp:bt709 range:tv
[format @ 0x742aec002b00] Setting 'pix_fmts' to value 'yuv420p'
[format @ 0x742aec002b00] Setting 'color_ranges' to value 'tv'
[AVFilterGraph @ 0x742aec001080] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
[mpeg4 @ 0x56bc7bb10440] intra_quant_bias = 0 inter_quant_bias = -64
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 21, dts 875875
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : iso6
    minor_version   : 1
    compatible_brands: mcl0iso6dsmsmsixdash
    encoder         : Lavf62.0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 22, dts 917583
  Stream #0:0(und), 0, 1/24000: Video: mpeg4, 1 reference frame (mp4v / 0x7634706D), yuv420p(tv, bt709, progressive), 960x540, 0/1, q=2-31, 200 kb/s, 23.98 fps, 24k tbn (default)
    Metadata:
      encoder         : Lavc62.0.101 mpeg4
      creation_time   : 2023-08-27T19:03:54.000000Z
      handler_name    : ?@GPAC2.3-DEV-rev7249-gb5923a16f-HEAD
      vendor_id       : [0][0][0][0]
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[out#0/mp4 @ 0x56bc7bb0fb40] Starting thread...

g2,mj2 @ 0x56bc7babab80] AVIndex stream 0, sample 2946, offset 6af6ff, dts 2947945, size 30, distance 45, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'sdtp' parent:'traf' sz: 58 1129 1179
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] track[0].sdtp.entries = 46
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] Duplicated SDTP atom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] type:'mdat' parent:'root' sz: 84479 1219 9223372036854775807
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] read fragments, offset 0x69ad26
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2900, dts 120954167
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2901, dts 120995875
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2902, dts 121037583
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2903, dts 121079292
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2904, dts 121121000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2905, dts 121162708
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2906, dts 121204417
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2907, dts 121246125
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2908, dts 121287833
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2909, dts 121329542
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2910, dts 121371250
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2911, dts 121412958
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2912, dts 121454667
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2913, dts 121496375
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2914, dts 121538083
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2915, dts 121579792
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2916, dts 121621500
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2917, dts 121663208
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2918, dts 121704917
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2919, dts 121746625
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2920, dts 121788333
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2921, dts 121830042
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2922, dts 121871750
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2923, dts 121913458
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2924, dts 121955167
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2925, dts 121996875
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2926, dts 122038583
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7babab80] stream 0, sample 2927, dts 122080292
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error submitting packet to decoder: Invalid data found when processing input
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] A decoder returned an unexpected error code. This is a bug, please report it.
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Error processing packet in decoder: Internal bug, should not have happened
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Task finished with error code: -558323010 (Internal bug, should not have happened)
[vist#0:0/vp9 @ 0x56bc7bb0f880] [dec:vp9 @ 0x56bc7bb0e540] Terminating thread with return code -558323010 (Internal bug, should not have happened)
[vist#0:0/vp9 @ 0x56bc7bb0f880] All consumers of this stream are done
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7baba8c0] All consumers are done
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7baba8c0] Terminating thread with return code 0 (success)
[vf#0:0 @ 0x56bc7baefd00] Filtering thread received EOF
[vf#0:0 @ 0x56bc7baefd00] Terminating thread with return code 0 (success)
[vost#0:0/mpeg4 @ 0x56bc7bb10000] [enc:mpeg4 @ 0x56bc7bb103c0] Encoder thread received EOF
[vost#0:0/mpeg4 @ 0x56bc7bb10000] Terminating thread with return code 0 (success)
[out#0/mp4 @ 0x56bc7bb0fb40] All streams finished
[out#0/mp4 @ 0x56bc7bb0fb40] Terminating thread with return code 0 (success)
[AVIOContext @ 0x56bc7baece40] Statistics: 8199058 bytes written, 2 seeks, 35 writeouts
[out#0/mp4 @ 0x56bc7bb0fb40] Output file #0 (out.mp4):
[out#0/mp4 @ 0x56bc7bb0fb40]   Output stream #0:0 (video): 2900 frames encoded; 2900 packets muxed (8184647 bytes); 
[out#0/mp4 @ 0x56bc7bb0fb40]   Total: 2900 packets (8184647 bytes) muxed
[out#0/mp4 @ 0x56bc7bb0fb40] video:7993KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.176025%
frame= 2900 fps=183 q=31.0 Lsize=    8007KiB time=00:02:00.95 bitrate= 542.3kbits/s speed=7.64x    
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7baba8c0] Input file #0 (corrupted.mp4):
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7baba8c0]   Input stream #0:0 (video): 2928 packets read (6978095 bytes); 2900 frames decoded; 12 decode errors; 
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x56bc7baba8c0]   Total: 2928 packets (6978095 bytes) demuxed
[AVIOContext @ 0x56bc7babb300] Statistics: 7013958 bytes read, 0 seeks
Conversion failed!
% echo $?
190

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (2)

corrupted-smal.mp4 (2.4 MB ) - added by jasper 15 months ago.
contains only the first 38 seconds
ffmpeg-20250424-150443.log (671.5 KB ) - added by jasper 15 months ago.
full command output. sorry should have upload this earlier

Change History (12)

by jasper, 15 months ago

Attachment: corrupted-smal.mp4 added

contains only the first 38 seconds

comment:1 by Balling, 15 months ago

Well, we need complete file... upload to google drive

comment:2 by MasterQuestionable, 15 months ago

Analyzed by developer: set
Cc: MasterQuestionable added
Component: undeterminedavcodec
Summary: Task finished with error code: -558323010Marker bit set VP9 may glitch internal "vp9" decoding?
Version: unspecifiedgit-master

͏    Sure the input is valid?
͏    https://www.rfc-editor.org/rfc/rfc9628.html#section-4.1-4

͏    Try decoding with "libvpx-vp9" instead?

͏    ----

͏    Interpreted:
͏    https://drive.usercontent.google.com/download?confirm=t&export=download&id=1lZFqrp631k8z-h0hY7Qm4J6DyiDKLyvk
͏    (~ 58.77 MiB; "corrupted.mp4")

Last edited 14 months ago by MasterQuestionable (previous) (diff)

by jasper, 15 months ago

Attachment: ffmpeg-20250424-150443.log added

full command output. sorry should have upload this earlier

in reply to:  2 comment:4 by jasper, 15 months ago

Replying to MasterQuestionable:

͏    Sure the input is valid?
͏    https://www.rfc-editor.org/rfc/rfc9628.html#section-4.1-4

͏    Try decoding with "libvpx-vp9" instead?

When I add "-c:v libvpx-vp9"
"Thread terminates with return code -558323010" still occurs

comment:5 by MasterQuestionable, 14 months ago

͏    Caveat "-c:v libvpx-vp9" needs to be input option for this case.
͏    If "libvpx-vp9" decoding also fails: likely just invalid file.

comment:6 by James, 14 months ago

Status: newopen
Summary: Marker bit set VP9 may glitch internal "vp9" decoding?BUG error code returned when decoding vp9
[libvpx-vp9 @ 0000022e6ef50b20] Failed to decode frame: Corrupt frame detected
[libvpx-vp9 @ 0000022e6ef50b20]   Additional information: Truncated packet or corrupt tile size

It's a broken file, so not much to do in that regard. What needs to be addressed is the AVERROR_BUG returned by the native vp9 decoder. That should not happen.

in reply to:  5 comment:7 by jasper, 14 months ago

Replying to MasterQuestionable:

͏    Caveat "-c:v libvpx-vp9" needs to be input option for this case.
͏    If "libvpx-vp9" decoding also fails: likely just invalid file.

i know corrupted.mp4 is a invalid file the problem as James said. is that it's not gracefully handle

comment:8 by mkver, 14 months ago

Reproduced by developer: set

It's not a bug in the decoder, but in the FFmpeg cli tool: In packet_decode() in ffmpeg_dec.c an AVPacket is sent to the decoder; if avcodec_send_packet() does not return an error, the AVFrames are received until the decoder signals EAGAIN. But if an error happens, no call to avcodec_receive_frame() happens and the decoder is supposed to need new input to produce any output. This is wrong for VP9 (and maybe some other decoders) as there is a BSF involved and the BSF need not have been completely drained.

comment:9 by MasterQuestionable, 14 months ago

Component: avcodecffmpeg
Keywords: ffmpeg_dec added; vp9 removed
Summary: BUG error code returned when decoding vp9Suboptimal logic in "ffmpeg_dec.c" may glitch abnormal VP9 decoding

͏    It's not a bug in the decoder, but in the FFmpeg CLI tool.
͏    In "packet_decode" in "ffmpeg_dec.c", an "AVPacket" is sent to the decoder:
͏    |*| If "avcodec_send_packet" does not return an error: the "AVFrame"s are received until the decoder signals "EAGAIN".
͏    |*| If an error happens: no call to "avcodec_receive_frame" happens
͏    ; and the decoder is supposed to need new input to produce any output.

͏    This is wrong for VP9 (and maybe some other decoders), as there is a BSF (Bitstream Filter?) involved.
͏    And the BSF need not have been completely drained.

͏    https://github.com/FFmpeg/FFmpeg/blob/848576b4dfdbacf42017bb81c755482dc6845cc5/fftools/ffmpeg_dec.c#L697
͏    https://ffmpeg.org/ffmpeg-bitstream-filters.html


͏    @ 2025-05-14T23:23:41Z
͏    fftools/ffmpeg_dec: Always receive frames from decoder
https://github.com/FFmpeg/FFmpeg/commit/b18aaf209f007e67ac4490ba5647ea139d1a6dcb
͏    “Up until now, if "avcodec_send_packet" returned an error: no attempt to receive a frame from the decoder would be made.
͏    Instead the decoder was presumed to be drained, so that more packets could be sent to it.
͏    Yet this need not be so:
͏    It can happen that a packet would decode to multiple frames.
͏    And that decoding the 1st of these (the one that is decoded during the "avcodec_send_packet" call) returns an error.
͏    .
͏    In which case the decoder is not yet ready to receive more input:
͏    As the remaining parts of the packet have not been decoded yet.
͏    In this case, an "AVERROR_BUG" is triggered.

͏    This happens in ticket #11553 with VP9:
͏    Which uses a BSF to split VP9 superframes; and is therefore affected by this.

͏    Fix this by always calling "avcodec_receive_frame" unless "-xerror" is set.”

Last edited 14 months ago by MasterQuestionable (previous) (diff)

comment:10 by mkver, 14 months ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.