Re-encode entire folders with ffmpeg


If you need to re-encode a lot of videos all at once, each video being in a different folder, here is a little bash script for you. Just put everything in a file and execute it. The file needs to be executed in the main directory where all the children folders are. If you have spaces in the name of the files, it’ll still work.

#!/bin/bash

for folder in "*"/
do
    for file in "$folder"/"*".flv
    do
        ffmpeg -i $file ${file%.*}.mp4
    done
done

It’s easy to understand, so you can adapt it to your own needs easily.