extracting mp3 audio from mp4: audio longer than video?

2

I have an mp4 video that has no audio/video sync issue. I tried to extract audio to an mp3 file, following the suggestion in this thread: Extracting audio from MP4 video into MP3

ffmpeg -i input_file.mp4 -vn -abr 128k -acodec libmp3lame output_file.mp3

However, the mp3 end up to be 7:51 long (while the video is 3:26). When I played the mp3, the player will terminate at 3:26. Why is this the case?

By the way, I also tried to use Mac builtin encoder to encode the mp4 to m4a (Finder->Services->Encode selected video file->Audio only), and there is no problem. The output m4a is 3:26 long.

4ae1e1

Posted 2013-05-07T21:41:32.580

Reputation: 1 306

1Please show the complete ffmpeg console output. How did you check the output file duration? -abr is not a valid option: you can use -b:a or -ab instead. – llogan – 2013-05-08T00:34:37.887

Answers

1

The player exits when there is nothing more to read. A file may appear longer (or shorter?) than it actually is when a VBR mp3 has incorrect frame / length headers. I'm not sure about the technical details, but there are tools such as mp3val to fix this issue.

Ярослав Рахматуллин

Posted 2013-05-07T21:41:32.580

Reputation: 9 076