I recently found myself with some video songs and audio files of other type than mp3. I wanted them to convert them to mp3, so I came up with this.
First of all you will need to install some packages. To do this, do:
sudo apt-get install gstreamer0.10-plugins-ugly-multiverse ffmpeg
Now you should be ready to go.
Go to your home directory, then .gnome2 directory and then nautilus-scripts directory. There you create new document, and name it MP3 Convert. Go to properties of this file, click permissions tab, and tick "Allow executing file as program" check box. Now edit it and insert the following code:
#!/bin/bash
the_file=$1
if [ "$NAUTILUS_SCRIPT_CURRENT_URI" != "file://$HOME/Desktop" ]; then
if [ "$NAUTILUS_SCRIPT_CURRENT_URI" == "x-nautilus-desktop:///" ]; then
files_path=$HOME"/Desktop"
else
files_path=`echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed -e 's/^file:\/\///; s/%20/\ /g'`
fi
else
files_path=""
fi
new_file=`echo $the_file | cut -d'.' -f1`
ffmpeg -i "$files_path/$the_file" -f mp3 -vn -acodec copy "$files_path/$new_file".mp3
if (( $? != 0 )); then
zenity --error --text "Failed converting. The following could have happened:\nYou don't have ffmpeg installed;\nThe file you used is not supported;\nOR\nThe file has already been converted." --title "Error";
fi
Now, you can convert any video or audio file to MP3 by right clicking it, selecting Scripts and MP3 Convert! If anything does not work, post here.
