How to convert mp4 to mp3 by shell script

Let's say you want to convert your video clips into mp3. Then you can write this script and run it inside of your Music folder. In that way you can easily convert bunch of videos.

Example:

#!/bin/bash
for f in *.mp4
do
    name=`echo "$f" | sed -e "s/.mp4$//g"`
    ffmpeg -i "$f" -vn -ar 44100 -ac 2 -ab 192k -f mp3 "$name.mp3"
done

Comments