Skip to content

Instantly share code, notes, and snippets.

@yangshun
Last active September 18, 2017 02:21
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 yangshun/8cdbb121f69eee811aceb8f9890cb5f9 to your computer and use it in GitHub Desktop.
Save yangshun/8cdbb121f69eee811aceb8f9890cb5f9 to your computer and use it in GitHub Desktop.
Converts mp4 to mp3 format.
# Place the ffmpeg binary in the same directory.
for video_file in *.mp4
do
audio_file="${video_file/.mp4/.mp3}"
if [ -f "$audio_file" ]; then
echo "$audio_file exists."
else
echo "Converting $video_file to $audio_file."
./ffmpeg -i "$video_file" -vn -sn -c:a mp3 -ab 192k "$audio_file"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment