Skip to content

Instantly share code, notes, and snippets.

@pahnin
Created July 6, 2013 12:13
Show Gist options
  • Save pahnin/5939728 to your computer and use it in GitHub Desktop.
Save pahnin/5939728 to your computer and use it in GitHub Desktop.
Bash script to convert multiple video files to mp3s using ffmpeg.. Don't know if someone already written similar or better script, this is just for my self satisfaction also I'll be glad if it is useful for others
#!/bin/bash
# Script License: GPL
# Dependensies: ffmpeg (You need ffmped installed in your system)
# Usage: "Takes single/multiple file paths as input and converts them to mp3"
# Example: "./convert_vid.sh Downloads/Amsterdam\ Imagine\ Dragons.flv Downloads/BrownRang.mp4" converts 'Downloads/Amsterdam Imagine Dragons.flv' and 'Downloads/BrownRang.mp4' to 'Downloads/Amsterdam Imagine Dragons.flv.mp3' and 'Downloads/BrownRang.mp4.mp3'
if [ $# -gt 0 ]; then
while test $# -gt 0
do
Filo=${1//\ /\\\ };
echo "
Converting $Filo
Command: ffmpeg -i $Filo -vn $Filo.mp3"
eval "ffmpeg -i $Filo -vn $Filo.mp3 "
shift
done
else
echo "
Which video file to convert?
Script usage ./convert.sh <video filepath> ...
";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment