Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#321 closed defect (worksforme)

Ffmpeg fails to detect format of piped input on some mp3 files

Reported by: gwg Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I am trying to decode an mp3 to raw wav data over a pipe. Ffmpeg reported being unable to detect the format of the input file, and did not transcode it (there was no output to the output file).

Here is the command:

cat badmp3file.mp3 | ffmpeg -v 10 -i - output.wav

And ffmpeg said:

FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.

configuration: --extra-version=4:0.5.1-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Mar 31 2011 18:59:37, gcc: 4.4.3

pipe:: Unknown format

However, with the following command, ffmepg is successful:

ffmpeg -v 9 -i badmp3file.mp3 outfile.wav

I will submit badmp3file.mp3 to the ftp server in the folder "gwg".

Thank you for your work!

Garth

Attachments (1)

badmp3file.mp3 (2.4 MB ) - added by gwg 13 years ago.
Ffmpeg fails on piped input of this file (ticket #321).

Change History (11)

by gwg, 13 years ago

Attachment: badmp3file.mp3 added

Ffmpeg fails on piped input of this file (ticket #321).

comment:1 by llogan, 13 years ago

Appears to be a corrupt input to me. The same FFmpeg won't decode it (assuming you're using FFmpeg from the Lucid repo):

$ ffmpeg -v 10 -i vbox/badmp3file.mp3 output2.wav
FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5.1-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Mar 31 2011 18:59:37, gcc: 4.4.3
[mp3 @ 0x1e68480]Could not find codec parameters (Audio: mp3, 0 channels, s16)
vbox/badmp3file.mp3: could not find codec parameters

Neither does recent Git:

$ ffmpeg -v 10 -i vbox/badmp3file.mp3 out.wav
ffmpeg version N-31074-ge1a5430, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jun 29 2011 15:44:09 with gcc 4.6.0 20110603 (prerelease)
  configuration: --prefix=/usr --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-vaapi --enable-vdpau --enable-x11grab
  libavutil    51. 10. 0 / 51. 10. 0
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  4. 0 / 53.  4. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 24. 0 /  2. 24. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mp3 @ 0x272f400] Format mp3 detected only with low score of 1, misdetection possible!
[mp3 @ 0x272f400] Could not find codec parameters (Audio: mp3, 0 channels, s16)
[mp3 @ 0x272f400] Estimating duration from bitrate, this may be inaccurate
vbox/badmp3file.mp3: could not find codec parameters
$ md5sum vbox/badmp3file.mp3 
2b5c1b099ebd44e6dd81673912112a5b  vbox/badmp3file.mp3

comment:2 by gwg, 13 years ago

Sorry, I think that's because of the truncation I did to comply with file upload size limits. I confirm that the uploaded mp3 file cannot be decoded using ffmpeg without a pipe. The untruncated version does get decoded successfully. Let me see if I can find a smaller mp3 that causes the bug that I can upload without truncating it.

comment:3 by Carl Eugen Hoyos, 13 years ago

Status: newopen

Consider using http://www.datafilehost.com to make your original sample available.

comment:4 by gwg, 13 years ago

Great suggestion, cehoyos, thank you. Here's the url to the full example mp3, uploaded on datafilehost: http://www.datafilehost.com/download-1d3bb7d1.html. This file should fail when it's piped, but decode successfully when it's passed with the "-i" flag in a normal invocation, as described in the original bug.

I will add that it's also successful if the input format is passed as a parameter to the piped invocation, like this:

cat ffmpeg_unpipeable.mp3 | ffmpeg -v 10 -f mp3 -i - testout.wav

The above invocation is successful, and produces output that seems pretty much identical to a normal non-piped invocation.

comment:5 by Carl Eugen Hoyos, 13 years ago

Resolution: worksforme
Status: openclosed

Works fine for me with latest git. Currently supported versions are 0.7.1, 0.8 and git HEAD (your version is several years old).
If you find a file that does not work correctly with a supported version, please do not hesitate to re-open this ticket!

cat ffmpeg_unpipeable.mp3 |ffmpeg -i - out.wav
ffmpeg version N-31097-ga099183, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jun 30 2011 23:03:35 with gcc 4.5.3
  configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-gpl --enable-libxvid
  libavutil    51. 11. 0 / 51. 11. 0
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  4. 0 / 53.  4. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 24. 0 /  2. 24. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mp3 @ 0x12c6400] Format mp3 detected only with low score of 1, misdetection possible!
[mp3 @ 0x12c6400] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x12c6400] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'pipe:':
  Metadata:
    encoder         : Lavf52.39.2
    title           : Smith Hill
    artist          : Deer Tick
    album           : Born on Flag Day
    ALBUMARTIST     : Deer Tick
    album_artist    : Deer Tick
    track           : 03/10
    disc            : 01/1
    date            : 2009
    genre           : Rock
    TDTG            : 2011-04-05T07:02:29
  Duration: N/A, start: 0.000000, bitrate: 320 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16, 320 kb/s
Output #0, wav, to 'out.wav':
  Metadata:
    TDTG            : 2011-04-05T07:02:29
    title           : Smith Hill
    artist          : Deer Tick
    album           : Born on Flag Day
    ALBUMARTIST     : Deer Tick
    album_artist    : Deer Tick
    track           : 03/10
    disc            : 01/1
    date            : 2009
    genre           : Rock
    encoder         : Lavf53.4.0
    Stream #0.0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
size=   38124kB time=00:03:41.30 bitrate=1411.2kbits/s
video:0kB audio:38124kB global headers:0kB muxing overhead 0.000113%

comment:6 by gwg, 13 years ago

I just cloned the latest git (git://git.videolan.org/ffmpeg.git, taken from the page http://www.ffmpeg.org/download.html) and built it with:

./configure
make

I experienced the exact same behavior as described in the original post. However, based on the report from cehoyos, it seems the problem is with my Linux and not with ffmpeg!

Thanks everyone for your time.

comment:7 by Carl Eugen Hoyos, 13 years ago

Could you provide complete, uncut output?

comment:8 by gwg, 13 years ago

I wasn't sure if you meant output of the build or output of the ffmpeg invocation. If you meant the invocation, here it is (using the git clone):

<PROMPT>$ cat ffmpeg_unpipeable.mp3 | ffmpeg -v 10 -i - testout.wav
FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5.1-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Mar 31 2011 18:59:37, gcc: 4.4.3
pipe:: Unknown format
<PROMPT>$

If you want the output from the build, please reply, and I'll rebuild it and put the build log up on pastebin or something (I don't have the log at hand or I would put it up now).

comment:9 by Carl Eugen Hoyos, 13 years ago

The output you provided is from a (at least!) two year old version of FFmpeg.
As said, only 0.7.1, 0.8 and git HEAD are supported.

comment:10 by gwg, 13 years ago

You're totally right. The build had failed and I didn't realize, so I was using my installed (old) ffmpeg in the above post. The new version (git head) succeeds.

Sorry for the mistake. Thank you so much for your time!

Note: See TracTickets for help on using tickets.