Opened 9 years ago

Last modified 9 years ago

#4214 new defect

Conversion to mp3 changes audio duration

Reported by: Shahar Mosek 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 Shahar Mosek 9 years ago.
PCM file. Duration is 1 minute.
test.mp3 (59.5 KB ) - added by Shahar Mosek 9 years ago.
MP3 file. Duration is 55 seconds
ffmpeg-20141230-145952.log (6.2 KB ) - added by Shahar Mosek 9 years ago.
FFMpeg report
WMP.PNG (12.5 KB ) - added by Shahar Mosek 9 years ago.
Image of display in media player
Explorer.PNG (8.1 KB ) - added by Shahar Mosek 9 years ago.
Image of display in Windows Explorer

Download all attachments as: .zip

Change History (15)

by Shahar Mosek, 9 years ago

Attachment: test.wav added

PCM file. Duration is 1 minute.

by Shahar Mosek, 9 years ago

Attachment: test.mp3 added

MP3 file. Duration is 55 seconds

by Shahar Mosek, 9 years ago

Attachment: ffmpeg-20141230-145952.log added

FFMpeg report

comment:1 by Shahar Mosek, 9 years ago

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

comment:2 by Carl Eugen Hoyos, 9 years ago

Component: ffmpegundetermined

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 by Shahar Mosek, 9 years ago

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.

by Shahar Mosek, 9 years ago

Attachment: WMP.PNG added

Image of display in media player

by Shahar Mosek, 9 years ago

Attachment: Explorer.PNG added

Image of display in Windows Explorer

comment:4 by Carl Eugen Hoyos, 9 years ago

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

comment:5 by Shahar Mosek, 9 years ago

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

comment:6 by Carl Eugen Hoyos, 9 years ago

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 by Shahar Mosek, 9 years ago

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 9 years ago by Shahar Mosek (previous) (diff)

comment:8 by Shahar Mosek, 9 years ago

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

comment:9 by Hendrik, 9 years ago

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 by Shahar Mosek, 9 years ago

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.