Mp3 extraction with avconv or ffmpeg doesn’t work properly anymore

audioffmpegmp3

Before upgrade to the latest Ubuntu I used the following command to extract mp3 from an avi file:

$ for x in *.avi; do ffmpeg -vol 100 -ab 160k -ar 44100 -i "$x" "`basename "$x" .avi`.mp3"; done

This worked. But since Ubuntu 12.04 I get Option sample_rate not found. when I try to execute this command. If I omit -ar 44100 (or -sample_rate 44100) it does extract the mp3, but in most cases the length of the extracted mp3 doesn't fit anymore. That means that they've got a length of 43min or something although the avi has a length of only 5min.

It's the same problem with both ffmpeg and avconv. Any ideas how to solve these problems?

Best Answer

Try with this instead:

ffmpeg -i "$x" -vol 100 -ab 160k -ar 44100 "`basename "$x" .avi`.mp3"

Before the options were in front of the input file, but it looks like you want to set them for the output file.

Related Question