Skip to content

Instantly share code, notes, and snippets.

@krisajenkins
Last active April 16, 2024 10:10
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 krisajenkins/1e6ffb3d35b1447b52fa2399f77c4db1 to your computer and use it in GitHub Desktop.
Save krisajenkins/1e6ffb3d35b1447b52fa2399f77c4db1 to your computer and use it in GitHub Desktop.
A simple script to pull mp3s out of mp4s.
#!/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