Skip to content

Instantly share code, notes, and snippets.

@yangshun yangshun/mp4-to-mp3.sh
Last active Sep 18, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.