Last active
April 16, 2024 10:10
-
-
Save krisajenkins/1e6ffb3d35b1447b52fa2399f77c4db1 to your computer and use it in GitHub Desktop.
A simple script to pull mp3s out of mp4s.
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
#!/bin/sh | |
usage() { | |
( | |
if [[ $# -ne 0 ]] | |
then | |
echo $* | |
echo | |
fi | |
echo "USAGE: `basename $0` <input.mp4>" | |
echo | |
)>&2 | |
exit 1 | |
} | |
[[ $# -eq 1 ]] || usage | |
INPUT=$1 | |
[[ -f $INPUT ]] || usage "Error: Input file not found:" $INPUT | |
EXTENSION="${INPUT##*.}" | |
[[ $EXTENSION == "mp4" ]] || usage "Error: Input file must be an mp4:" $INPUT | |
OUTPUT=`basename $INPUT .mp4`.mp3 | |
ffmpeg -i $INPUT -vn -b:a 192k $OUTPUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment