Skip to content

Instantly share code, notes, and snippets.

@michezio
Created June 7, 2023 09:45
Show Gist options
  • Save michezio/88b2fe6252a1782790cd5fdcbacba4d6 to your computer and use it in GitHub Desktop.
Save michezio/88b2fe6252a1782790cd5fdcbacba4d6 to your computer and use it in GitHub Desktop.
Bulk convert image files from a format to another
#! /bin/bash
srcExt=$1
destExt=$2
srcDir=$3
destDir=$4
opts=$5
for filename in "$srcDir"/*.$srcExt; do
basePath=${filename%.*}
baseName=${basePath##*/}
ffmpeg -i "$filename" $opts "$destDir"/"$baseName"."$destExt"
done
echo "Conversion from ${srcExt} to ${destExt} complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment