Opened 10 years ago

Last modified 10 years ago

#3563 new defect

wrong duration reported by ffmpeg

Reported by: chinshou Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: wav mp3
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
ffmpeg reported attached mp3 file with duration 00:07:52. But VLC and windows media player report it has duration with 03:56
How to reproduce:

% ffplay -i HIT_118.MP3

ffplay version N-62460-gef818d8 Copyright (c) 2003-2014 the FFmpeg developers
  built on Apr 14 2014 22:01:48 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable
  libavutil      52. 76.100 / 52. 76.100
  libavcodec     55. 58.103 / 55. 58.103
  libavformat    55. 37.100 / 55. 37.100
  libavdevice    55. 13.100 / 55. 13.100
  libavfilter     4.  4.100 /  4.  4.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, wav, from 'HIT_118.MP3': 0KB vq=    0KB sq=    0B f=0/0
  Duration: 00:07:52.72, bitrate: 27 kb/s
    Stream #0:0: Audio: mp3 (U[0][0][0] / 0x0055), 22050 Hz, stereo, s16p, 56 kb
   6.06 M-A:  0.000 fd=   0 aq=    1KB vq=    0KB sq=    0B f=0/0

Attachments (1)

HIT_118.MP3 (1.6 MB ) - added by chinshou 10 years ago.

Download all attachments as: .zip

Change History (5)

by chinshou, 10 years ago

Attachment: HIT_118.MP3 added

comment:1 by Carl Eugen Hoyos, 10 years ago

Keywords: mp3 added
Version: unspecifiedgit-master

How was the sample created?

in reply to:  1 comment:2 by chinshou, 10 years ago

Replying to cehoyos:

How was the sample created?

I have no idea how was the mp3 created.

comment:3 by jamal, 10 years ago

Component: undeterminedavformat
Keywords: wav added

The file contains a 'fact' chunk, and the wav demuxer is using it to calculate the duration, whereas other players seem to be ignoring it.
The value of the chunk is 10423511, which when divided by the sample rate gives 7:52 minutes. If you then divide that by number of channels you get the actual length of 3:56.

The spec says that the 'fact' chunk value should be number of samples per channel, so chances are the value in this file is wrong (being total samples across all channels instead of samples per channel), but I don't have any other stereo non-pcm wav files with 'fact' chunks to verify that.

comment:4 by broham, 10 years ago

Jamal, do you know of a work around that could be used to get the duration on a file with this problem?

Note: See TracTickets for help on using tickets.