I wanted an easy way to convert music to MP3 from various formats under Konqueror in KDE on Kubuntu Linux. I found an interesting post about creating a KDE Service Menu which got me started in the right direction. However, I didn’t like the way ffmpeg converted to 64kbps MP3 quality and the bad sounding results regardless of the bitrate settings that I chose. I tried lame, and was quite pleased with the results. I also didn’t like the way the service menu used the entire filename without stripping the dotted extension, so I copied another service menu perl example. My “Convert to MP3” service menu script goes into the following location:

/usr/share/apps/konqueror/servicemenus/

File convertmp3.desktop:

[Desktop Entry]
ServiceTypes=audio/*
Actions=convertToMP3

[Desktop Action convertToMP3]
Name=Convert to MP3
Exec=lame -V2 %f "`echo %f | perl -pe 's/\.[^.]+$//'`.mp3"

Enjoy!