Convert (or Extract) to MP3 using FFMPEG

article #316, updated 4271 days ago

To convert many formats to MP3, and to extract audio from many video formats to MP3 files, one may use FFMPEG:

ffmpeg -i outputfile.mp3

A bash script to create an mp3 from every file in a folder, is thus:

for sourcefile in *; do 
	ffmpeg -i "${sourcefile}" -ab 192k "${sourcefile}".mp3

Notice the “-ab 192k”. By default, ffmpeg seems to transcode to MP3 at 64k, regardless of input; this is not very high quality, whereas 192k does well for general use.