Opened 9 years ago

Closed 9 years ago

#4628 closed defect (fixed)

FLAC encoder output is not decodable to a bitexact reproduction

Reported by: George Boyle Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: flac
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
When encoding the attached sample wav, the result cannot be decoded to a bitexact version of the original.

On decoding, the following warning is output:

[flac @ 0x7f6534497100]invalid rice order: 4 blocksize 1049
[flac @ 0x7f6534497100]decode_frame() failed

How to reproduce:

% ffmpeg -i trimmedchorus.wav -c flac trimmedchorus.flac
ffmpeg version  N-72933-gec5164a
built on 2015-06-14

I have used the reference flac implementation/tool (from the xiph website) to test the results. The flac tool can successfully encode and decode the same sample, and running flac -t trimmedchorus.flac on the ffmpeg-encoded version produces: ERROR, MD5 signature mismatch.

Attachments (1)

trimmedchorus.wav (364.2 KB ) - added by George Boyle 9 years ago.
Original wav sample file

Download all attachments as: .zip

Change History (4)

by George Boyle, 9 years ago

Attachment: trimmedchorus.wav added

Original wav sample file

comment:1 by George Boyle, 9 years ago

Console output (encoding):

$ ./ffmpeg -i trimmedchorus.wav -c flac trimmedchorus_new.flac
ffmpeg version N-72933-gec5164a Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.1.0 (GCC)
  configuration: --toolchain=gcov --samples=fate-suite/ --enable-avisynth --enable-avresample --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-version3
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 17.100 /  5. 17.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, wav, from 'trimmedchorus.wav':
  Metadata:
    encoder         : Lavf56.25.101
  Duration: 00:00:02.11, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
File 'trimmedchorus_new.flac' already exists. Overwrite ? [y/N] y
Output #0, flac, to 'trimmedchorus_new.flac':
  Metadata:
    encoder         : Lavf56.36.100
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      encoder         : Lavc56.41.100 flac
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native))
Press [q] to stop, [?] for help
size=     310kB time=00:00:02.11 bitrate=1203.4kbits/s    
video:0kB audio:302kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.676536%
$

Console output (decoding):

$ ./ffmpeg -i trimmedchorus_new.flac -c pcm_s16le trimmedchorus_new.wav
ffmpeg version N-72933-gec5164a Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.1.0 (GCC)
  configuration: --toolchain=gcov --samples=fate-suite/ --enable-avisynth --enable-avresample --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-version3
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 17.100 /  5. 17.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, flac, from 'trimmedchorus_new.flac':
  Metadata:
    ENCODER         : Lavf56.36.100
  Duration: 00:00:02.11, start: 0.000000, bitrate: 1203 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
Output #0, wav, to 'trimmedchorus_new.wav':
  Metadata:
    ISFT            : Lavf56.36.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Metadata:
      encoder         : Lavc56.41.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[flac @ 0x3322a60] invalid rice order: 4 blocksize 1049
[flac @ 0x3322a60] decode_frame() failed
size=     360kB time=00:00:02.08 bitrate=1411.5kbits/s    
video:0kB audio:360kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.021159%
$ 

Using flac tool to test encoded file:

$ flac -t trimmedchorus_new.flac
flac 1.3.1, Copyright (C) 2000-2009  Josh Coalson, 2011-2014  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

trimmedchorus_new.flac: ERROR, MD5 signature mismatch
$

comment:2 by Carl Eugen Hoyos, 9 years ago

Keywords: flacenc removed
Priority: normalimportant
Reproduced by developer: set
Status: newopen

Regression since 254da44bf97e4d5d919a5363f476f936f3c06ccd

$ ffmpeg -i trimmedchorus.wav out.flac
ffmpeg version N-72939-g5b0f55a Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration:
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 17.100 /  5. 17.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, wav, from 'trimmedchorus.wav':
  Metadata:
    encoder         : Lavf56.25.101
  Duration: 00:00:02.11, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Output #0, flac, to 'out.flac':
  Metadata:
    encoder         : Lavf56.36.100
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      encoder         : Lavc56.41.100 flac
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native))
Press [q] to stop, [?] for help
size=     310kB time=00:00:02.11 bitrate=1203.4kbits/s
video:0kB audio:302kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.676536%

comment:3 by Carl Eugen Hoyos, 9 years ago

Resolution: fixed
Status: openclosed

Fixed by you in 2469ed32c81ebf2347e6883091c566724b286167
Thank you for the report and the fix!

Note: See TracTickets for help on using tickets.