Opened 6 years ago

Closed 6 years ago

#2266 closed enhancement (fixed)

support flac crcchecks

Reported by: dericed Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: flac crc
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

FLAC uses an md5 in the header to verify that the audio data is correct. It also uses crcs to allow any damage to be identified more precisely. FFmpeg has a -err_detect crccheck option but it doesn't work on flac.

How to reproduce:

Apply a data fuzzer to a valid flac file.

ffmpeg -i test.flac -f null -err_detect crccheck -
ffmpeg version 1.1.git Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 12 2013 19:07:29 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-ffplay --enable-libopenjpeg --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5 '
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.103 / 54. 91.103
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 37.101 /  3. 37.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[flac @ 0x7f932a836e00] max_analyze_duration 5000000 reached at 5088000 microseconds
Input #0, flac, from 'test.flac':
  Metadata:
    MAJOR_BRAND     : isom
    MINOR_VERSION   : 1
    COMPATIBLE_BRANDS: isom
    ENCODER         : Lavf54.63.100
  Duration: 00:00:30.05, bitrate: 996 kb/s
    Stream #0:0: Audio: flac, 48000 Hz, stereo, s32
Output #0, null, to 'pipe:':
  Metadata:
    MAJOR_BRAND     : isom
    MINOR_VERSION   : 1
    COMPATIBLE_BRANDS: isom
    encoder         : Lavf54.63.100
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (flac -> pcm_s16le)
Press [q] to stop, [?] for help
size=N/A time=00:00:30.04 bitrate=N/A    
video:0kB audio:5634kB subtitle:0 global headers:0kB muxing overhead -100.000381%

No error is provided, although the file is damaged with a crc mismatch.

Via the flac utility the same file is assessed like this:

flac -d -V test.flac 

flac 1.2.1, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007  Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

test.flac: 20% completetest.flac: *** Got error code 2:FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH


test.flac: ERROR while decoding data
           state = FLAC__STREAM_DECODER_READ_FRAME

Although flac acknowledges the presence of an error it only notes that it occurs ~20% into the decoding. I would recommend ffmpeg report the pts of where the error is identified, similar to how the crccheck is reported in ffv1.3.

Change History (2)

comment:1 Changed 6 years ago by richardpl

flac crc checks are mostly useless. flac could have error and crc check would just not report it.

comment:2 Changed 6 years ago by cehoyos

  • Component changed from undetermined to avcodec
  • Keywords changed from flac, crc to flac crc
  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from unspecified to git-master

Fixed by James Almer.

Note: See TracTickets for help on using tickets.