Opened 12 years ago
Closed 11 years ago
#2590 closed defect (fixed)
Inaccurate seek in mp3
Reported by: | eleventeen | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avformat |
Version: | git-master | Keywords: | mp3 regression |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Summary of the bug:
After adding read_xing_toc() in mp3dec.c seeking in some mp3 isn't accurate. The same file seeks correctly and fast in foobar2000. Attached sample of a file and original cue.
How to reproduce:
ffplay -ss 227 Underworld_sample.mp3 (should start approximately from begining of a song. starts a lot earlier)
Attachments (1)
Change History (11)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Sample files uploaded to ftp://upload.mplayerhq.hu/MPlayer/incoming
Underworld.cue
Underworld_sample.mp3
(and Underworld.txt as requested in http://ffmpeg.org/bugreports.html)
The same problem is reproducible also in my own code. Havn't tried yet in ffmpeg. Problem dissapears after commenting read_xing_toc() function.
Do you want the console output from ffplay or ffmpeg?
comment:3 by , 12 years ago
The same problem in ffmpeg.
./ffmpeg -v 9 -loglevel 99 -ss 227 -i Underworld_sample.mp3 o.wav ffmpeg version 1.1.git Copyright (c) 2000-2013 the FFmpeg developers built on May 19 2013 12:16:24 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --disable-yasm --enable-debug libavutil 52. 33.100 / 52. 33.100 libavcodec 55. 10.101 / 55. 10.101 libavformat 55. 7.100 / 55. 7.100 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 68.101 / 3. 68.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 Splitting the commandline. Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'. Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '227'. Reading option '-i' ... matched as input file with argument 'Underworld_sample.mp3'. Reading option 'o.wav' ... matched as output file. Finished splitting the commandline. Parsing a group of options: global . Applying option v (set logging level) with argument 9. Successfully parsed a group of options. Parsing a group of options: input file Underworld_sample.mp3. Applying option ss (set the start time offset) with argument 227. Successfully parsed a group of options. Opening an input file: Underworld_sample.mp3. [mp3 @ 0x178c8a0] Format mp3 probed with size=8192 and score=51 [mp3 @ 0x178c8a0] id3v2 ver:3 flags:00 len:2416 [mp3 @ 0x178c8a0] pad 576 1932 [mp3 @ 0x178c8a0] File position before avformat_find_stream_info() is 3052 [mp3 @ 0x178c8a0] max_analyze_duration 5000000 reached at 5015510 microseconds [mp3 @ 0x178c8a0] File position after avformat_find_stream_info() is 125932 Input #0, mp3, from 'Underworld_sample.mp3': Metadata: artist : Lilith album : Underworld genre : Gothic Metal date : 2007 Duration: 00:42:36.63, start: 0.000000, bitrate: 32 kb/s Stream #0:0, 194, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16p, 192 kb/s Successfully opened the file. Parsing a group of options: output file o.wav. Successfully parsed a group of options. Opening an output file: o.wav. Successfully opened the file. [graph 0 input from stream 0:0 @ 0x17903c0] Setting 'time_base' to value '1/44100' [graph 0 input from stream 0:0 @ 0x17903c0] Setting 'sample_rate' to value '44100' [graph 0 input from stream 0:0 @ 0x17903c0] Setting 'sample_fmt' to value 's16p' [graph 0 input from stream 0:0 @ 0x17903c0] Setting 'channel_layout' to value '0x3' [graph 0 input from stream 0:0 @ 0x17903c0] tb:1/44100 samplefmt:s16p samplerate:44100 chlayout:0x3 [audio format for output stream 0:0 @ 0x17904c0] Setting 'sample_fmts' to value 's16' [audio format for output stream 0:0 @ 0x17904c0] auto-inserting filter 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the filter 'audio format for output stream 0:0' [AVFilterGraph @ 0x178f880] query_formats: 4 queried, 9 merged, 3 already done, 0 delayed [auto-inserted resampler 0 @ 0x1791fe0] ch:2 chl:stereo fmt:s16p r:44100Hz -> ch:2 chl:stereo fmt:s16 r:44100Hz Output #0, wav, to 'o.wav': Metadata: IART : Lilith IPRD : Underworld IGNR : Gothic Metal ICRD : 2007 ISFT : Lavf55.7.100 Stream #0:0, 0, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 -> #0:0 (mp3 -> pcm_s16le) Press [q] to stop, [?] for help incomplete frametime=00:02:47.78 bitrate=1600.2kbits/s Error while decoding stream #0:0: Invalid data found when processing input [output stream 0:0 @ 0x17901a0] EOF on sink link output stream 0:0:default. No more output streams to write to, finishing. size= 39087kB time=00:03:24.43 bitrate=1566.3kbits/s video:0kB audio:39087kB subtitle:0 global headers:0kB muxing overhead 0.000380% 8686 frames successfully decoded, 1 decoding errors [AVIOContext @ 0x178d880] Statistics: 4 seeks, 8689 writeouts [AVIOContext @ 0x1794f20] Statistics: 5577342 bytes read, 1 seeks
comment:4 by , 12 years ago
The file you uploaded cannot be played here, could you confirm the md5sum value?
$ ffmpeg -i Underworld_sample.mp3 ffmpeg version N-53271-g68c4633 Copyright (c) 2000-2013 the FFmpeg developers built on May 19 2013 17:33:03 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl --disable-indev=jack libavutil 52. 33.100 / 52. 33.100 libavcodec 55. 10.101 / 55. 10.101 libavformat 55. 7.100 / 55. 7.100 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 68.101 / 3. 68.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 Underworld_sample.mp3: Invalid data found when processing input
$ md5sum Underworld_sample.mp3 7cd5718719f0d3141dfcef4c693ac6c8 Underworld_sample.mp3
comment:5 by , 12 years ago
md5 is: EDDD2DEA9E3D30C6FAE78F830976EDF5
Now it is uploaded here:
https://sites.google.com/site/armampreleases/home/Underworld_sample.mp3?attredirects=0&d=1
Please let me know when you download it because I can't share it publicly.
by , 12 years ago
Attachment: | Underworld_sample_cut.mp3 added |
---|
comment:6 by , 12 years ago
Keywords: | mp3 regression added |
---|---|
Priority: | normal → important |
Reproduced by developer: | set |
Status: | new → open |
Regression since 5864ce1 / 50d1f44
out.wav starts at ~25sec and is too long.
$ ffmpeg -ss 50 -i Underworld_sample_cut.mp3 -t 10 out.wav ffmpeg version N-53274-g73b9f31 Copyright (c) 2000-2013 the FFmpeg developers built on May 19 2013 19:14:12 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl --disable-indev=jack libavutil 52. 33.100 / 52. 33.100 libavcodec 55. 10.101 / 55. 10.101 libavformat 55. 7.100 / 55. 7.100 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 68.101 / 3. 68.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 [mp3 @ 0x3106840] max_analyze_duration 5000000 reached at 5015510 microseconds Input #0, mp3, from 'Underworld_sample_cut.mp3': Metadata: artist : Lilith album : Underworld genre : Gothic Metal date : 2007 Duration: 00:42:36.63, start: 0.000000, bitrate: 4 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 192 kb/s Output #0, wav, to 'out.wav': Metadata: IART : Lilith IPRD : Underworld IGNR : Gothic Metal ICRD : 2007 ISFT : Lavf55.7.100 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 (mp3 -> pcm_s16le) Press [q] to stop, [?] for help size= 5936kB time=00:00:10.02 bitrate=4851.9kbits/s video:0kB audio:5936kB subtitle:0 global headers:0kB muxing overhead 0.002501%
$ ffmpeg -i out.wav -f null - ffmpeg version N-53274-g73b9f31 Copyright (c) 2000-2013 the FFmpeg developers built on May 19 2013 19:14:12 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl --disable-indev=jack libavutil 52. 33.100 / 52. 33.100 libavcodec 55. 10.101 / 55. 10.101 libavformat 55. 7.100 / 55. 7.100 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 68.101 / 3. 68.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 [wav @ 0x34bf840] max_analyze_duration 5000000 reached at 5015510 microseconds Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, wav, from 'out.wav': Metadata: artist : Lilith date : 2007 genre : Gothic Metal album : Underworld encoder : Lavf55.7.100 Duration: 00:00:34.46, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Output #0, null, to 'pipe:': Metadata: artist : Lilith date : 2007 genre : Gothic Metal album : Underworld encoder : Lavf55.7.100 Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le) Press [q] to stop, [?] for help size=N/A time=00:00:34.45 bitrate=N/A video:0kB audio:5936kB subtitle:0 global headers:0kB muxing overhead -100.000362%
comment:7 by , 11 years ago
Replying to eleventeen:
Summary of the bug:
After adding read_xing_toc() in mp3dec.c seeking in some mp3 isn't accurate. The same file seeks correctly and fast in foobar2000. Attached sample of a file and original cue.
Is the seeking in foobar2000 faster than libavformat without TOC ?
comment:8 by , 11 years ago
On PC I don't see speed difference with and without read_xing_toc() when seeking near the end of a 60MB mp3. The only difference is accuracy. I'v checked with process monitor what foobar2000 is doing. The first time it is reading the file from the beginning until it finds the right place. Second seek to the same time (or before) it jumps immediately to remembered position.
comment:10 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fixed (for cbr mp3) in e096283ea55bc36a637b47329e19ddb26fb1440b
Is this only reproducible with ffplay or also with ffmpeg?
To make this a valid ticket, please add the failing command line together with the complete, uncut console output.