Friday, July 27, 2012

Command-Line Media Conversion

Tired of searching for those ever-changing media converter applications, or for an online conversion site that is actually working at any one time?

Search no more!! Install ffmpeg (and sox too) and learn how to convert media from most formats into most other formats... easily-peasily!

Common usage:

ffmpeg -i input.mp4 out.mkv
Done! Give it whichever input file in any format, tell it which file to output to (with the appropriate extension), and press [ENTER]! You'll have your toasty new file in a few seconds, minutes, hours, days, months, or years, depending on your computational power, file size, network speed (if applicable). Most likely a few seconds will suffice. Convert AVI-MP3, MP3-WAV, AVI-MKV, MOV-AVI, MKV-MP3, MOV-AIFF, or whatever you want! (Just make sure it makes sense - you can get audio out of video, but most probably not the other way around).

Also consider sox, an audio-specialized application with a wider spectrum of formats, precise control over channels, sample rates, dithering, and many other audio-specific attributes, effects, and synthesizers, plus other great tools like direct file playing and recording:
  • Play a music file: play musicFile.mp3
  • Recording yourself into a wave file: rec myRecording.wav
  • Convert all the .raw files in your current directory to wave files: for f in *.raw; do sox -r 16000 $f ${f/.raw/.wav}; done

There ya go! Apply and enjoy! Credits due:

No comments:

Post a Comment