How do you convert an entire directory with ffmpeg?

Eugene picture Eugene · Apr 26, 2011 · Viewed 251.4k times · Source

How do you convert an entire directory/folder with ffmpeg via command line or with a batch script?

Answer

llogan picture llogan · Nov 17, 2015

For Linux and macOS this can be done in one line, using parameter expansion to change the filename extension of the output file:

for i in *.avi; do ffmpeg -i "$i" "${i%.*}.mp4"; done