Ffmpeg batch script

From WikiPaul - Paul Swanson's wiki

Jump to: navigation, search

This reads every .flv file in the directory (and it's allowed to have spaces), echo it, run ffmpeg on it to convert it to avi, then remove the .flv part.

ls *.flv | while read file; do
        echo $file
        ffmpeg -i "$file" "$file"\.avi
        rename 's/\.flv\.avi/.avi/' "$file"
done
And you could eliminate/simplify the above by including the rename within the ffmpeg instead of running it as another command:
ffmpeg -i "$file" "${file%.flv}.avi"
Personal tools