Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#2533 closed defect (fixed)

FLAC with blocksize of 32768 gives problems

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

Description

Summary of the bug: For some reason, when trying to decode a FLAC-file with a blocksize of exactly 32768 gives errors

How to reproduce:
1) Take an audio file and encode it with the FLAC tools as flac --lax -b 32768 infile.wav
2) Try ffmpeg -i infile.flac outfile.wav
3) See strange errors popping up (depending on the input file)
4) Try again with flac --lax -b 32767 and flac --lax -b 32769 and see the problem not happening

I ran the following script to test in depth
for i in {32700..32900}; do echo $i; flac -f noise.flac -b $i --lax --silent; ffmpeg -y -loglevel error -i noise.flac test.wav; done
and only 32768 gives me an error

When using real music, I get errors like this
martijn@MartijnKubuntu:~$ ffmpeg -y -i test.flac test.wav
ffmpeg version N-52724-gb937d36 Copyright (c) 2000-2013 the FFmpeg developers

built on May 3 2013 21:48:33 with gcc 4.7 (Ubuntu/Linaro? 4.7.2-2ubuntu1)
configuration: --enable-libx264 --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gpl
libavutil 52. 28.100 / 52. 28.100
libavcodec 55. 7.100 / 55. 7.100
libavformat 55. 4.101 / 55. 4.101
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 63.101 / 3. 63.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100

Input #0, flac, from 'test.flac':

Duration: 00:00:07.40, bitrate: 622 kb/s

Stream #0:0: Audio: flac, 44100 Hz, stereo, s16

Output #0, wav, to 'test.wav':

Metadata:

ISFT : Lavf55.4.101
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s

Stream mapping:

Stream #0:0 -> #0:0 (flac -> pcm_s16le)

Press [q] to stop, ? for help
[flac @ 0x2d281c0] invalid predictor order: 7 > -1024
[flac @ 0x2d281c0] decode_frame() failed
Error while decoding stream #0:0: Invalid data found when processing input
[flac @ 0x2d281c0] invalid predictor order: 8 > -8192
[flac @ 0x2d281c0] decode_frame() failed
Error while decoding stream #0:0: Invalid data found when processing input
[flac @ 0x2d281c0] invalid predictor order: 8 > -32768
[flac @ 0x2d281c0] decode_frame() failed
[...]
Error while decoding stream #0:0: Invalid data found when processing input
[flac @ 0x2d281c0] invalid predictor order: 8 > -32768
[flac @ 0x2d281c0] decode_frame() failed
Error while decoding stream #0:0: Invalid data found when processing input
[flac @ 0x2d281c0] invalid predictor order: 7 > -1024
[flac @ 0x2d281c0] decode_frame() failed
Error while decoding stream #0:0: Invalid data found when processing input
size= 123kB time=00:00:00.71 bitrate=1412.1kbits/s
video:0kB audio:123kB subtitle:0 global headers:0kB muxing overhead 0.063763%

When trying noise, I get this
martijn@MartijnKubuntu:~$ ffmpeg -y -i noise.flac test.wav
ffmpeg version N-52724-gb937d36 Copyright (c) 2000-2013 the FFmpeg developers

built on May 3 2013 21:48:33 with gcc 4.7 (Ubuntu/Linaro? 4.7.2-2ubuntu1)
configuration: --enable-libx264 --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gpl
libavutil 52. 28.100 / 52. 28.100
libavcodec 55. 7.100 / 55. 7.100
libavformat 55. 4.101 / 55. 4.101
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 63.101 / 3. 63.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100

Input #0, flac, from 'noise.flac':

Duration: 00:00:08.10, bitrate: 3080 kb/s

Stream #0:0: Audio: flac, 192000 Hz, mono, s16

Output #0, wav, to 'test.wav':

Metadata:

ISFT : Lavf55.4.101
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 192000 Hz, mono, s16, 3072 kb/s

Stream mapping:

Stream #0:0 -> #0:0 (flac -> pcm_s16le)

Press [q] to stop, ? for help
[flac @ 0x2e621c0] CRC error at PTS 0
[flac @ 0x2e621c0] get_buffer() failed
Error while decoding stream #0:0: Invalid argument
[flac @ 0x2e621c0] CRC error at PTS 0
[flac @ 0x2e621c0] get_buffer() failed
Error while decoding stream #0:0: Invalid argument
[flac @ 0x2e621c0] CRC error at PTS 0
[flac @ 0x2e621c0] get_buffer() failed
[...]
Error while decoding stream #0:0: Invalid argument
[flac @ 0x2e621c0] CRC error at PTS 0
[flac @ 0x2e621c0] get_buffer() failed
Error while decoding stream #0:0: Invalid argument
[flac @ 0x2e621c0] CRC error at PTS 0
[flac @ 0x2e621c0] get_buffer() failed
Error while decoding stream #0:0: Invalid argument
size= 30kB time=00:00:00.07 bitrate=3082.3kbits/s
video:0kB audio:30kB subtitle:0 global headers:0kB muxing overhead 0.334010%

The resulting file only has the audio in the last block, of which the framesize is not exactly 32768 (because the file length is not an exact multiple of 32768.

Change History (4)

comment:1 Changed 3 years ago by ktf

  • Component changed from undetermined to avcodec
  • Keywords flac added
  • Priority changed from normal to minor
  • Version changed from unspecified to git-master

comment:2 Changed 3 years ago by cehoyos

  • Priority changed from minor to normal
  • Reproduced by developer set
  • Status changed from new to open

comment:3 Changed 3 years ago by cehoyos

  • Keywords regression added
  • Priority changed from normal to important
  • Resolution set to fixed
  • Status changed from open to closed

Regression since d4df4e5.

Should be fixed, thank you for the report!

comment:4 Changed 3 years ago by ktf

Works for me now, thanks.

Note: See TracTickets for help on using tickets.