Skip to content

Instantly share code, notes, and snippets.

@thefotios
Created November 2, 2011 15:16
Show Gist options
  • Select an option

  • Save thefotios/1333887 to your computer and use it in GitHub Desktop.

Select an option

Save thefotios/1333887 to your computer and use it in GitHub Desktop.
ffmpeg batch conversion script. This script will take in mutlitple files from the command line and process them using the same ffmpeg options.
# Script for converting list of files using ffmpeg
#
# Author: Fotios Lindiakos (fotioslindiakos@gmail.com)
#
# Usage: batch_ffmpeg.sh file1 [file2 file3 ...]
extension=mp3
options="-y"
for source in "$@"
do
base=$(echo $source | cut -d "." -f1)
target="$base.$extension"
echo "Converting: $source -> $target"
# Do the conversion
ffmpeg $options -i $source $target
# Adjust the modification date
touch --date="$(date -r $source)" $target
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment