Opened 3 years ago

Last modified 3 years ago

#4214 new defect

Conversion to mp3 changes audio duration

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

Description

When converting PCM files to MP3, I get audio files with different duration than the original. This only happens when the PCM files are mono. Stereo files are converted correctly.

Attachments (5)

test.wav (945.4 KB) - added by smosek 3 years ago.
PCM file. Duration is 1 minute.
test.mp3 (59.5 KB) - added by smosek 3 years ago.
MP3 file. Duration is 55 seconds
ffmpeg-20141230-145952.log (6.2 KB) - added by smosek 3 years ago.
FFMpeg report
WMP.PNG (12.5 KB) - added by smosek 3 years ago.
Image of display in media player
Explorer.PNG (8.1 KB) - added by smosek 3 years ago.
Image of display in Windows Explorer

Download all attachments as: .zip

Change History (15)

Changed 3 years ago by smosek

PCM file. Duration is 1 minute.

Changed 3 years ago by smosek

MP3 file. Duration is 55 seconds

Changed 3 years ago by smosek

FFMpeg report

comment:1 Changed 3 years ago by smosek

Command used was ffmpeg.exe -i test.wav -f mp3 test.mp3.
Run on Windows

comment:2 Changed 3 years ago by cehoyos

  • Component changed from ffmpeg to undetermined

Why do you think that test.mp3 is 55 seconds long?
It is actually over a minute long (like the wav file that you attached).

comment:3 Changed 3 years ago by smosek

The actual audio is indeed 1 minute, but if you look at it in Windows Explorer or Windows Media Player, the duration is displayed as 55 seconds.

Changed 3 years ago by smosek

Image of display in media player

Changed 3 years ago by smosek

Image of display in Windows Explorer

comment:4 Changed 3 years ago by cehoyos

Are you maybe reporting this issue on the wrong bug tracker?

comment:5 Changed 3 years ago by smosek

What do you mean? Where should I be reporting it?

comment:6 Changed 3 years ago by cehoyos

If vlc, MPlayer, xine, totem and FFmpeg show the correct duration but WMP shows the wrong duration, I would suspect that the bug is in WMP.
Please test -write_xing 0, this may be a work-around.

comment:7 Changed 3 years ago by smosek

VLC does not really show the correct duration. It shows the wrong duration, but gradually adjusts the duration until it reaches the correct one.
The work-around does work, however, but it is not helpful, since I need the calls to play in HTML5 player on IE, and it does not play MP3 files without the XING header.

Last edited 3 years ago by smosek (previous) (diff)

comment:8 Changed 3 years ago by smosek

This appears to be the same problem as https://trac.ffmpeg.org/ticket/2697.

comment:9 Changed 3 years ago by heleppkes

Next step would be to manually check the duration value which is written into the Xing header, its very well possible that it might be writing a wrong value. If the written value is correct, than thats another story.

comment:10 Changed 3 years ago by smosek

I don't see a duration value in the XING header.
I did find that when writing the XING header, the XING frame has a bitrate of 24kbps, while the rest of the frames have a bitrate of 8 kbps. This goes well with the fact that opening the audio in an HTML5 player in IE shows a length of 20 seconds for the audio (instead of 1 minute).
If I manually modify this bitrate to 8kbps, the audio duration is correct in the HTML5 player.
I believe FFMPEG writes the XING frame as though the audio was stereo even if it is mono audio, which is the cause of the problem. This also explains why the problem is not seen with stereo calls.

Note: See TracTickets for help on using tickets.