Opened 12 years ago
Closed 12 years ago
#3599 closed defect (invalid)
mp3 encoder set wrong bitrate or version flag
| Reported by: | croex | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | git-master | Keywords: | mp3 |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
when i convert a audio to mp3, and detect it by command[file], it return wrong bitrate info.
% ffmpeg -i input.mp3 -b:a 32k -c:a libmp3lame output.mp3 ffmpeg version 10769 ~/av » ffmpeg ffmpeg version 2.1.3 Copyright (c) 2000-2013 the FFmpeg developers built on Jan 17 2014 09:39:01 with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --arch=x86_64 --enable-runtime-cpudetect libavutil 52. 48.101 / 52. 48.101 libavcodec 55. 39.101 / 55. 39.101 libavformat 55. 19.104 / 55. 19.104 libavdevice 55. 5.100 / 55. 5.100 libavfilter 3. 90.100 / 3. 90.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 % file output.mp3 output.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v2, 56 kbps, 22.05 kHz, Stereo
command [file] detect mp3 by its frame header according to http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html.
is it possible ffmpeg set the wrong frame header or other reasons?
Change History (7)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Please add the complete, uncut console output to make this a valid ticket.
comment:3 by , 12 years ago
10782 ~/av » ffmpeg -i 432859.mp3 -b:a 32k -c:a libmp3lame -y output.mp3
ffmpeg version 2.1.3 Copyright (c) 2000-2013 the FFmpeg developers
built on Jan 17 2014 09:39:01 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --arch=x86_64 --enable-runtime-cpudetect
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
[mp3 @ 0x7fbd40818200] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '432859.mp3':
Metadata:
title : 002
artist : ���������� www.5tps.com
album : ���������� www.5tps.com
comment : ���������� www.5tps.com
Duration: 00:21:19.08, start: 0.000000, bitrate: 32 kb/s
Stream #0:0: Audio: mp3, 22050 Hz, stereo, s16p, 32 kb/s
Output #0, mp3, to 'output.mp3':
Metadata:
TIT2 : 002
TPE1 : ���������� www.5tps.com
TALB : ���������� www.5tps.com
comment : ���������� www.5tps.com
TSSE : Lavf55.19.104
Stream #0:0: Audio: mp3 (libmp3lame), 22050 Hz, stereo, s16p, 32 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mp3 -> libmp3lame)
Press [q] to stop, [?] for help
[mp3 @ 0x7fbd40820800] Header missingate= 32.0kbits/s
Error while decoding stream #0:0: Invalid data found when processing input
size= 4996kB time=00:21:18.95 bitrate= 32.0kbits/s
video:0kB audio:4996kB subtitle:0 global headers:0kB muxing overhead 0.006939%
10783 ~/av » file output.mp3
output.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v2, 56 kbps, 22.05 kHz, Stereo
the complete, uncut console
follow-up: 5 comment:4 by , 12 years ago
| Component: | undetermined → avformat |
|---|---|
| Keywords: | mp3 added |
| Version: | unspecified → git-master |
I suspect file does not support xing headers, use -write_xing 0 as a workaround.
follow-up: 6 comment:5 by , 12 years ago
Replying to cehoyos:
I suspect file does not support xing headers, use
-write_xing 0as a workaround.
I found the bug was fixed, tks :)
http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=617a1a98a6be3e59db6fbfc21afab2fb9a049c03;hp=254c95cdd1b669a722204a4a65974fc2523c8f83
comment:6 by , 12 years ago
Replying to ltzliwe:
Replying to cehoyos:
I suspect file does not support xing headers, use
-write_xing 0as a workaround.
I found the bug was fixed, tks :)
http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=617a1a98a6be3e59db6fbfc21afab2fb9a049c03;hp=254c95cdd1b669a722204a4a65974fc2523c8f83
This commit was already part of 2.1.3 so I don't think it could have fixed your issue.
Additionally, I can also reproduce it here with (current FFmpeg git head and) file-5.11.
$ffmpeg -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -vn -ab 32k -map_metadata -1 out.mp3
ffmpeg version N-62951-g3316556 Copyright (c) 2000-2014 the FFmpeg developers
built on May 4 2014 09:03:53 with gcc 4.7 (SUSE Linux)
configuration: --enable-gpl --enable-libvorbis --enable-libvpx --enable-libmp3lame
libavutil 52. 81.100 / 52. 81.100
libavcodec 55. 60.103 / 55. 60.103
libavformat 55. 37.102 / 55. 37.102
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 5.100 / 4. 5.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/svq3/Vertical400kbit.sorenson3.mov':
Metadata:
creation_time : 2001-03-20 16:17:18
title : Vertical Online SV3 Demo
title-eng : Vertical Online SV3 Demo
artist : Logan Kelsey
artist-eng : Logan Kelsey
copyright : © Vertical Online 2001
copyright-eng : © Vertical Online 2001
encoder : Sorenson Video 3
encoder-eng : Sorenson Video 3
Duration: 00:00:43.58, start: 0.000000, bitrate: 580 kb/s
Stream #0:0(eng): Video: svq3 (SVQ3 / 0x33515653), yuvj420p(pc), 320x240, 391 kb/s, 30.02 fps, 30 tbr, 600 tbn, 600 tbc (default)
Metadata:
creation_time : 2001-03-20 16:17:18
handler_name : Apple Alias Data Handler
encoder : Sorenson Video 3
Stream #0:1(eng): Audio: adpcm_ima_qt (ima4 / 0x34616D69), 44100 Hz, mono, s16p, 176 kb/s (default)
Metadata:
creation_time : 2001-03-20 16:17:18
handler_name : Apple Alias Data Handler
Output #0, mp3, to 'out.mp3':
Metadata:
TSSE : Lavf55.37.102
Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, mono, s16p, 32 kb/s (default)
Stream mapping:
Stream #0:1 -> #0:0 (adpcm_ima_qt -> libmp3lame)
Press [q] to stop, [?] for help
Multiple frames in a packet from stream 1
size= 171kB time=00:00:43.59 bitrate= 32.1kbits/s
video:0kB audio:170kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.130087%
$ file out.mp3 out.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 56 kbps, 44.1 kHz, Monaural
$ ffmpeg -i out.mp3
ffmpeg version N-62951-g3316556 Copyright (c) 2000-2014 the FFmpeg developers
built on May 4 2014 09:03:53 with gcc 4.7 (SUSE Linux)
configuration: --enable-gpl --enable-libvorbis --enable-libvpx --enable-libmp3lame
libavutil 52. 81.100 / 52. 81.100
libavcodec 55. 60.103 / 55. 60.103
libavformat 55. 37.102 / 55. 37.102
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 5.100 / 4. 5.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mp3, from 'out.mp3':
Metadata:
encoder : Lavf55.37.102
Duration: 00:00:43.62, start: 0.025057, bitrate: 32 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, mono, s16p, 32 kb/s
At least one output file must be specified
Works fine if no XING header is written:
$ ffmpeg -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -write_xing 0 -ab 32k outnoxing.mp3
ffmpeg version N-62951-g3316556 Copyright (c) 2000-2014 the FFmpeg developers
built on May 4 2014 09:03:53 with gcc 4.7 (SUSE Linux)
configuration: --enable-gpl --enable-libvorbis --enable-libvpx --enable-libmp3lame
libavutil 52. 81.100 / 52. 81.100
libavcodec 55. 60.103 / 55. 60.103
libavformat 55. 37.102 / 55. 37.102
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 5.100 / 4. 5.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/svq3/Vertical400kbit.sorenson3.mov':
Metadata:
creation_time : 2001-03-20 16:17:18
title : Vertical Online SV3 Demo
title-eng : Vertical Online SV3 Demo
artist : Logan Kelsey
artist-eng : Logan Kelsey
copyright : © Vertical Online 2001
copyright-eng : © Vertical Online 2001
encoder : Sorenson Video 3
encoder-eng : Sorenson Video 3
Duration: 00:00:43.58, start: 0.000000, bitrate: 580 kb/s
Stream #0:0(eng): Video: svq3 (SVQ3 / 0x33515653), yuvj420p(pc), 320x240, 391 kb/s, 30.02 fps, 30 tbr, 600 tbn, 600 tbc (default)
Metadata:
creation_time : 2001-03-20 16:17:18
handler_name : Apple Alias Data Handler
encoder : Sorenson Video 3
Stream #0:1(eng): Audio: adpcm_ima_qt (ima4 / 0x34616D69), 44100 Hz, mono, s16p, 176 kb/s (default)
Metadata:
creation_time : 2001-03-20 16:17:18
handler_name : Apple Alias Data Handler
Output #0, mp3, to 'outnoxing.mp3':
Metadata:
encoder-eng : Sorenson Video 3
TIT2 : Vertical Online SV3 Demo
title-eng : Vertical Online SV3 Demo
TPE1 : Logan Kelsey
artist-eng : Logan Kelsey
TCOP : © Vertical Online 2001
copyright-eng : © Vertical Online 2001
TSSE : Lavf55.37.102
Stream #0:0(eng): Audio: mp3 (libmp3lame), 44100 Hz, mono, s16p, 32 kb/s (default)
Metadata:
creation_time : 2001-03-20 16:17:18
handler_name : Apple Alias Data Handler
Stream mapping:
Stream #0:1 -> #0:0 (adpcm_ima_qt -> libmp3lame)
Press [q] to stop, [?] for help
Multiple frames in a packet from stream 1
size= 171kB time=00:00:43.59 bitrate= 32.1kbits/s
video:0kB audio:170kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.177652%
$ file outnoxing.mp3 outnoxing.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 32 kbps, 44.1 kHz, Monaural
comment:7 by , 12 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
Well, the xing header needs some space and so the lower bitrates either cannot contain it or the first packet has a higher bitrate.
I dont see how this could be fixed but if someone has an idea dont hesitate to explain how and reopen the ticket



bitrate detected by [file] aways higher than expected, maybe it is not a bug, but i can't determine it.
the sample input file: http://ztest.qiniudn.com/432859.mp3