Opened 3 years ago

Last modified 2 years ago

#9272 new defect

Unstable outputs of ffmpeg

Reported by: Shaohua Li Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords:
Cc: Shaohua Li Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug: For some inputs, ffmpeg's output file will change per run.

Compile args: ./configure

Compiler: gcc11

How to reproduce: (run the following command several times, and check the size of unstable_output in each run. )

% ffmpeg -i unstable_input -f mp4 unstable_output
ffmpeg version N-102631-gbaf5cc5b7a Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.1.0-1ubuntu1~20.04)
  configuration: --cc=gcc-11 --cxx=g++-11 --ld='g++-11 -fno-sanitize=vptr -std=c++11' --extra-cflags=-I/data/afl_compiler/programs/ffmpeg/src/head-gcc11/ffmpeg_deps/include --extra-ldflags=-L/data/afl_compiler/programs/ffmpeg/src/head-gcc11/ffmpeg_deps/lib --prefix=/data/afl_compiler/programs/ffmpeg/src/head-gcc11/ffmpeg_deps --pkg-config-flags=--static --disable-shared
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  1.100 / 59.  1.100
  libavformat    59.  2.101 / 59.  2.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.101 /  8.  0.101
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
[avi @ 0x5561e674d700] Something went wrong during header parsing, tag IST[4] has size 1862270977, I will ignore it and try to continue anyway.
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from 'bugs/diff_0':
  Duration: 00:00:01.67, start: 0.000000, bitrate: 1021 kb/s
  Stream #0:0: Video: mpeg4 (DIVX / 0x58564944), yuv420p, 352x240 [SAR 1:1 DAR 22:15], 29.97 fps, 29.97 tbr, 29.97 tbn
  Stream #0:1: Audio: pcm_alaw ([6][0][0][0] / 0x0006), 44100 Hz, stereo, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> mpeg4 (native))
  Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native))
Press [q] to stop, [?] for help
[mpeg4 @ 0x5561e6783d40] ac-tex damaged at 7 3
[mpeg4 @ 0x5561e6783d40] Error at MB: 76
[mpeg4 @ 0x5561e6783d40] concealing 306 DC, 306 AC, 306 MV errors in I frame
bugs/diff_0: corrupt decoded frame in stream 0
Output #0, mp4, to '.output':
  Metadata:
    encoder         : Lavf59.2.101
  Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(progressive), 352x240 [SAR 1:1 DAR 22:15], q=2-31, 200 kb/s, 29.97 fps, 11988 tbn
    Metadata:
      encoder         : Lavc59.1.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc59.1.100 aac
[mpeg4 @ 0x5561e6783d40] P cbpy damaged at 10 300:00:00.74 bitrate=   0.5kbits/s speed=4.59x    
[mpeg4 @ 0x5561e6783d40] Error at MB: 79
[mpeg4 @ 0x5561e6783d40] concealing 329 DC, 329 AC, 329 MV errors in P frame
[mpeg4 @ 0x5561e6779dc0] P cbpy damaged at 17 5
[mpeg4 @ 0x5561e6779dc0] Error at MB: 132
[mpeg4 @ 0x5561e6779dc0] marker does not match f_code
[mpeg4 @ 0x5561e6779dc0] concealing 257 DC, 257 AC, 257 MV errors in P frame
[mpeg4 @ 0x5561e678fa80] P cbpy damaged at 3 4
[mpeg4 @ 0x5561e678fa80] Error at MB: 95
[mpeg4 @ 0x5561e678fa80] concealing 303 DC, 303 AC, 303 MV errors in P frame
bugs/diff_0: corrupt decoded frame in stream 0
    Last message repeated 1 times
[mpeg4 @ 0x5561e6779dc0] 2. marker bit missing in 3. esc
[mpeg4 @ 0x5561e6779dc0] Error at MB: 39
[mpeg4 @ 0x5561e6779dc0] marker does not match f_code
[mpeg4 @ 0x5561e6779dc0] concealing 330 DC, 330 AC, 330 MV errors in P frame
bugs/diff_0: corrupt decoded frame in stream 0
    Last message repeated 1 times
[mpeg4 @ 0x5561e677af00] Error at MB: 117
[mpeg4 @ 0x5561e677af00] concealing 267 DC, 267 AC, 267 MV errors in I frame
[mpeg4 @ 0x5561e6796200] ac-tex damaged at 12 0
[mpeg4 @ 0x5561e6796200] Error at MB: 12
[mpeg4 @ 0x5561e6796200] concealing 330 DC, 330 AC, 330 MV errors in P frame
bugs/diff_0: corrupt decoded frame in stream 0
[mpeg4 @ 0x5561e677af00] ac-tex damaged at 6 1
[mpeg4 @ 0x5561e677af00] Error at MB: 29
[mpeg4 @ 0x5561e677af00] concealing 330 DC, 330 AC, 330 MV errors in P frame
bugs/diff_0: corrupt decoded frame in stream 0
    Last message repeated 1 times
frame=   45 fps=0.0 q=3.9 Lsize=     104kB time=00:00:01.60 bitrate= 532.8kbits/s speed=3.41x    
video:77kB audio:25kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.671106%
[aac @ 0x5561e677ebc0] Qavg: 185.202

Attachments (2)

unstable_input (207.9 KB ) - added by Shaohua Li 3 years ago.
unstable_input
helgrind.log (1.4 MB ) - added by Cigaes 3 years ago.
truncated helgrind output of ffmpeg -an -i unstable_input.avi -f framecrc -y test01.crc (without debug symbols)

Download all attachments as: .zip

Change History (6)

by Shaohua Li, 3 years ago

Attachment: unstable_input added

unstable_input

comment:1 by Balling, 3 years ago

This is AVI file.

comment:2 by Cigaes, 3 years ago

The problem is not encoding, it is decoding, and it is with the video. It can be observed with just:

ffmpeg -an -i unstable_input.avi -f framecrc -y test01.crc

It shows CRC differences as soon as the second frame.

It is a threading issue: adding -threads 1 makes the differences go away, and helgrind prints a lot of errors. I will attach a log from an installed ffmpeg, without debug symbols.

by Cigaes, 3 years ago

Attachment: helgrind.log added

truncated helgrind output of ffmpeg -an -i unstable_input.avi -f framecrc -y test01.crc (without debug symbols)

comment:3 by Shaohua Li, 3 years ago

Analyzed by developer: set
Reproduced by developer: set

in reply to:  2 comment:4 by Shaohua Li, 2 years ago

Replying to Nicolas George:

The problem is not encoding, it is decoding, and it is with the video. It can be observed with just:

ffmpeg -an -i unstable_input.avi -f framecrc -y test01.crc

It shows CRC differences as soon as the second frame.

It is a threading issue: adding -threads 1 makes the differences go away, and helgrind prints a lot of errors. I will attach a log from an installed ffmpeg, without debug symbols.

Hi, I reported another related issue, where the output files keep changes and -threads 1 won't work. (see https://trac.ffmpeg.org/ticket/9476)

Note: See TracTickets for help on using tickets.