Skip to content

Instantly share code, notes, and snippets.

@nicolaschan
Created May 4, 2019 04:07
Show Gist options
  • Select an option

  • Save nicolaschan/4c5eafda84d43d627f52e68f93977897 to your computer and use it in GitHub Desktop.

Select an option

Save nicolaschan/4c5eafda84d43d627f52e68f93977897 to your computer and use it in GitHub Desktop.
Wrapper script to parallelize ffmpeg
#!/bin/sh
# Wrapper script to help parallelize batches of ffmpeg conversions to a single output format
# For example, it can convert all your mp4 files to mp3 format in parallel (or any other formats ffmpeg supports)
# By Nicolas Chan (MIT Licensed)
# Usage: ./convert.sh FORMAT [INPUT_FILES...]
# Example usage: ./convert.sh mp3 *.mp4
# Dependencies:
# - ffmpeg: https://ffmpeg.org/
# - GNU parallel: https://www.gnu.org/software/parallel/
OUTPUT_FORMAT=$1
shift
parallel "ffmpeg -i {} -f $OUTPUT_FORMAT {.}.$OUTPUT_FORMAT" ::: "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment