Opened 4 years ago

Last modified 4 years ago

#8403 new defect

Incorrect exit code when checking corrupted FFV1 file

Reported by: yohann Owned by:
Priority: minor Component: avformat
Version: git-master Keywords: mkv ffv1
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When I use ffmpeg for fixity checks (FFV1 encodec files), the output correctly mentions if there are CRC mismatch issues.
But ffmpeg still exits with a 0 status code which makes it unsuable if I want to use it in a "check and process" workflow.

Is it possible to do so we get a non-zero exit status when errors are detected ?

The relevant error lines in the log are :

[ffv1 @ 0x7ff9e4ff7000] CRC mismatch 46612353!at 0.335000 seconds
[ffv1 @ 0x7ff9e4ff7000] bytestream end mismatching by 7564819

Command :

ffmpeg -report -v 9 -loglevel 99  -i corrupted_FFV1.mkv -f null -

Log file :

ffmpeg started on 2019-11-26 at 16:27:45
Report written to "ffmpeg-20191126-162745.log"
Command line:
ffmpeg -report -v 9 -loglevel 99 -i corrupted_FFV1.mkv -f null -
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.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_FFV1.mkv'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'null'.
Reading option '-' ... 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_FFV1.mkv.
Successfully parsed a group of options.
Opening an input file: corrupted_FFV1.mkv.
[NULL @ 0x7ff9e2801800] Opening 'corrupted_FFV1.mkv' for reading
[file @ 0x7ff9e1f00580] Setting default whitelist 'file,crypto'
[matroska,webm @ 0x7ff9e2801800] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
[matroska,webm @ 0x7ff9e2801800] Before avformat_find_stream_info() pos: 949 bytes read:32768 seeks:0 nb_streams:1
[matroska,webm @ 0x7ff9e2801800] parser not found for codec ffv1, packets or times may be invalid.
[matroska,webm @ 0x7ff9e2801800] parser not found for codec ffv1, packets or times may be invalid.
[matroska,webm @ 0x7ff9e2801800] All info found
[matroska,webm @ 0x7ff9e2801800] After avformat_find_stream_info() pos: 7560435 bytes read:7560435 seeks:0 frames:1
Input #0, matroska,webm, from 'corrupted_FFV1.mkv':
  Metadata:
    ENCODER         : Lavf56.40.101
  Duration: 00:00:00.38, start: 0.000000, bitrate: 1551147 kb/s
    Stream #0:0, 1, 1/1000: Video: ffv1, 1 reference frame (FFV1 / 0x31564646), gbrp10le, 4872x3248, 0/1, SAR 1:1 DAR 3:2, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      ENCODER         : Lavc56.60.100 ffv1
      DURATION        : 00:00:00.376000000
Successfully opened the file.
Parsing a group of options: output url -.
Applying option f (force format) with argument null.
Successfully parsed a group of options.
Opening an output file: -.
Successfully opened the file.
detected 16 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (ffv1 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[matroska,webm @ 0x7ff9e2801800] Unknown entry 0xD7 at pos. 72903740
[matroska,webm @ 0x7ff9e2801800] Element at 0x4586c3c ending at 0x49ec089 exceeds containing master element ending at 0x4586cf1
[ffv1 @ 0x7ff9e4ff7000] CRC mismatch 46612353!at 0.335000 seconds
[matroska,webm @ 0x7ff9e2801800] Unknown entry 0x2EDD8E at pos. 72903680
[matroska,webm @ 0x7ff9e2801800] Unknown entry 0xE6 at pos. 72903745
[matroska,webm @ 0x7ff9e2801800] Unknown entry 0xF0 at pos. 72903811
[matroska,webm @ 0x7ff9e2801800] Unknown entry 0x79BB at pos. 72903862
[matroska,webm @ 0x7ff9e2801800] File ended prematurely at pos. 72903921 (0x4586cf1)
[ffv1 @ 0x7ff9e4ff7000] bytestream end mismatching by 7564819
[graph 0 input from stream 0:0 @ 0x7ff9e1e01140] Setting 'video_size' to value '4872x3248'
[graph 0 input from stream 0:0 @ 0x7ff9e1e01140] Setting 'pix_fmt' to value '77'
[graph 0 input from stream 0:0 @ 0x7ff9e1e01140] Setting 'time_base' to value '1/1000'
[graph 0 input from stream 0:0 @ 0x7ff9e1e01140] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x7ff9e1e01140] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x7ff9e1e01140] Setting 'frame_rate' to value '24/1'
[graph 0 input from stream 0:0 @ 0x7ff9e1e01140] w:4872 h:3248 pixfmt:gbrp10le tb:1/1000 fr:24/1 sar:1/1 sws_param:flags=2
[AVFilterGraph @ 0x7ff9e1e00c80] query_formats: 3 queried, 2 merged, 0 already done, 0 delayed
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0, 0, 1/24: Video: wrapped_avframe, 1 reference frame, gbrp10le, 4872x3248 [SAR 1:1 DAR 3:2], 0/1, q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc (default)
    Metadata:
      DURATION        : 00:00:00.376000000
      encoder         : Lavc58.54.100 wrapped_avframe
frame=    1 fps=0.0 q=-0.0 size=N/A time=00:00:00.04 bitrate=N/A speed=0.0768x    
frame=    2 fps=1.0 q=-0.0 size=N/A time=00:00:00.08 bitrate=N/A speed=0.0408x    
frame=    8 fps=3.1 q=-0.0 size=N/A time=00:00:00.33 bitrate=N/A speed=0.129x    
[out_0_0 @ 0x7ff9e3900780] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
frame=    9 fps=3.4 q=-0.0 Lsize=N/A time=00:00:00.37 bitrate=N/A speed=0.142x    
video:5kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (corrupted_FFV1.mkv):
  Input stream #0:0 (video): 9 packets read (72902577 bytes); 9 frames decoded; 
  Total: 9 packets (72902577 bytes) demuxed
Output file #0 (pipe:):
  Output stream #0:0 (video): 9 frames encoded; 9 packets muxed (4824 bytes); 
  Total: 9 packets (4824 bytes) muxed
9 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x7ff9e1f00700] Statistics: 80678594 bytes read, 1 seeks

Change History (4)

comment:1 by yohann, 4 years ago

The CRC invalid FFV1 file can be downloaded here :
https://cloud.cfav.fr/index.php/s/cmrHQHSnP548ofq

comment:2 by mkver, 4 years ago

Have you tried setting the explode err_detect flag?

comment:3 by yohann, 4 years ago

Just tried it, the exit code is still 0 and the transcoding isn't aborted.

comment:4 by Carl Eugen Hoyos, 4 years ago

Component: undeterminedavformat
Keywords: mkv ffv1 added
Priority: normalminor
Note: See TracTickets for help on using tickets.