Extracting audio from video

FFmpeg does this well:

ffmpeg -i movie.flv -ab 256k -vn -ss 23 -t 00:04:58 -vol 512 mysong.mp4

The optional arguments mean:

  • -ab 256k: 256k bitrate (seems to mean the upper bound, the actual bitrate seems to turn out to be less and setting higher didn't change file size but the default of 64k was very bad)
  • -vn: no video
  • -ss 23: start extracting at the 23 second mark (HH:MM:SS format also accepted)
  • -t 00:04:58: extract for a duration of 4:58 minutes
  • -vol 512: set the volume. 256 is the default; 512 doubles that.

I chose mp4 because it seems to be portable and it worked with the seeking and truncation options. For more information, of course, see the FFmpeg documentation.

Then mysong.mp4 can be added to your iTunes library.

For extracting something that's mostly speech, you can get away with lower quality:

ffmpeg -i speech.flv -vn -ac 1 -ar 22050 audio.mp3