Last active
September 18, 2017 02:21
-
-
Save yangshun/8cdbb121f69eee811aceb8f9890cb5f9 to your computer and use it in GitHub Desktop.
Converts mp4 to mp3 format.
This file contains 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
# 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