Skip to content

Instantly share code, notes, and snippets.

@astromme
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astromme/fafd4bac9c5090a4ae76 to your computer and use it in GitHub Desktop.
Save astromme/fafd4bac9c5090a4ae76 to your computer and use it in GitHub Desktop.
Parallel Convert Files to MP3 with FFMPEG
#!/bin/bash
INPUT_DIR="."
INPUT_FILE_EXTENSION=".flac"
BITRATE="320k"
OUTPUT_DIR="MP3"
OUTPUT_FILE_EXTENSION=".mp3"
N_PARALLEL=4
find "$INPUT_DIR" -print0 | xargs -0 -n 1 -P $N_PARALLEL sh -c 'ffmpeg -i "$1" -ab $BITRATE "$OUTPUT_DIR/${1%$INPUT_FILE_EXTENSION}$OUTPUT_FILE_EXTENSION"' sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment