Opened 10 years ago

Closed 10 years ago

#3918 closed defect (fixed)

Bitrate incorrectly detected when decoding mp2

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

Description

Summary of the bug:

When using the "mp2" audio encoder, the output file is longer than the input file by an amount that depends on the original duration.

In the example (5 minute) file, the output duration was increased by 2 seconds. For a movie length title, I have observed increases of around 10 seconds. The input content does not appear to matter.

How to reproduce:

% ffmpeg -i ~/tmp/test.mp3 ~/out.mp2
ffmpeg version 2.3.3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Sep  2 2014 11:24:19 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: 
  libavutil      52. 92.100 / 52. 92.100
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.100 / 55. 48.100
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.100 /  4. 11.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
Input #0, mp3, from '/home/user/tmp/test.mp3':
  Duration: 00:04:53.46, start: 0.025056, bitrate: 327 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
Output #0, mp2, to '/home/user/out.mp2':
    Stream #0:0: Audio: mp2, 44100 Hz, stereo, s16, 384 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 (native) -> mp2 (native))
Press [q] to stop, [?] for help
size=   13756kB time=00:04:53.44 bitrate= 384.0kbits/s    
video:0kB audio:13756kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

% ffprobe ~/out.mp2 
ffprobe version 2.3.3 Copyright (c) 2007-2014 the FFmpeg developers
  built on Sep  2 2014 11:24:19 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: 
  libavutil      52. 92.100 / 52. 92.100
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.100 / 55. 48.100
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.100 /  4. 11.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
[mp3 @ 0x2c41020] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '/home/user/out.mp2':
  Duration: 00:04:55.00, start: 0.000000, bitrate: 381 kb/s
    Stream #0:0: Audio: mp2, 44100 Hz, stereo, s16p, 381 kb/s

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (4)

comment:1 by Carl Eugen Hoyos, 10 years ago

Is this issue reproducible with current FFmepg git head?

Please provide an input sample that allows to reproduce this.

comment:2 by abc123, 10 years ago

This is reproducible on HEAD N-66060-g971e0ec. It affects ALL input audio files, and I'm sure you have an mp3 somewhere on your computer to verify it.

comment:3 by Carl Eugen Hoyos, 10 years ago

Keywords: mp2 regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Summary: MP2 audio encoder increases stream durationBitrate incorrectly detected when decoding mp2
Version: 2.3git-master

Regression since c33351f3

$ ffmpeg -f lavfi -i sine -t 3600 out.mp2
$ ffmpeg -i out.mp2 -f null -
ffmpeg version N-66066-g928cb84 Copyright (c) 2000-2014 the FFmpeg developers
  built on Sep  3 2014 09:31:54 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  3.100 / 56.  3.100
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  0.103 /  5.  0.103
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
[mp3 @ 0x2aa3d40] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'out.mp2':
  Duration: 01:01:12.14, start: 0.000000, bitrate: 376 kb/s
    Stream #0:0: Audio: mp2, 44100 Hz, mono, s16p, 376 kb/s
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf56.3.100
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
    Metadata:
      encoder         : Lavc56.1.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (mp2 (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size=N/A time=01:00:00.01 bitrate=N/A
video:0kB audio:310079kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Actual bitrate is 384kb/s.

comment:4 by Michael Niedermayer, 10 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.