Skip to content

Instantly share code, notes, and snippets.

@jonnymaceachern
Created August 28, 2019 14:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jonnymaceachern/bd2f66ffaa6dadab16970bb793ee6605 to your computer and use it in GitHub Desktop.
Save jonnymaceachern/bd2f66ffaa6dadab16970bb793ee6605 to your computer and use it in GitHub Desktop.
Batch convert mp4 to webm using ffmpeg
for i in *.mp4;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" -acodec libvorbis -aq 5 -ac 2 -qmax 25 -threads 2 "${name}.webm"
done
@jonnymaceachern
Copy link
Author

jonnymaceachern commented Aug 28, 2019

Usage

  1. Install ffmpeg
  2. Download batch-convert-mp4-webm.sh (Link)
  3. Move script to any directory that's part of your environment $PATH (e.g. ~/bin)
  4. Make the script executable (chmod +x batch-convert-mp4-webm.sh)
  5. cd to the directory with the mp4 files
  6. Run command with no arguments (batch-convert-mp4-webm.sh)

Note: ffmpeg must be available in your environment $PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment