Last active
August 29, 2015 14:17
-
-
Save mgrabovsky/0bd5e9bceff89c10048e to your computer and use it in GitHub Desktop.
Speed up a bunch of MP3 using ffmpeg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for %i in (input/*.mp3) do @ffmpeg -i "input/%i" -filter:a "atempo=1.33" -vn "%i" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for f in input/*.mp3 ; do ffmpeg -i "$f" -filter:a 'atempo=1.33' -vn "${f#input/}" ; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| if [[ $# != 1 ]]; then | |
| echo "Usage: $0 <respekt-nn-yyyy.zip>" | |
| exit 1 | |
| fi | |
| path=$(realpath $1) | |
| outdir=${1%.zip} | |
| pushd /var/tmp >/dev/null | |
| echo "Extracting $1..." | |
| unzip $path -d $outdir || exit 1 | |
| cd $outdir | |
| # Put unprocessed files aside | |
| mkdir unprocessed && mv *.mp3 unprocessed | |
| # Exclude last file in the playlist | |
| excluded=$(tr -d "\r" < playlist.pls | perl -ne 'm/^File\d+=(.+\n?)/ && print $1' - | tail -1) | |
| mv "unprocessed/$excluded" . || exit 1 | |
| echo 'Processing files...' | |
| # Process the files | |
| for f in unprocessed/*.mp3; do | |
| ffmpeg -i "$f" -filter:a 'atempo=1.33' -vn "${f#unprocessed/}" || exit 1 | |
| done | |
| echo 'Cleaning up...' | |
| # Clean up original files | |
| rm -r unprocessed | |
| popd >/dev/null | |
| # Move processed files into current directory | |
| mv /var/tmp/$outdir . || exit 1 | |
| echo | |
| echo "Done. Processed files are in $outdir" | |
| echo "You may want to rmove the original $1 later" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment