![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
Tutorials & Tips The place to find Ubuntu related Tips & Tricks. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Dipped in Ubuntu
![]() Join Date: May 2005
Location: Cydonia
My beans are hidden!
Ubuntu 9.04 Jaunty Jackalope
|
Script: Easily change quality of MP3 files
DISCLAIMER: I don't want this topic turning into a discussion of how bad it is to turn a low quality mp3 into an even lower quality mp3. I don't want to "kill" their mp3s; I want to provide them with a solution to a very viable problem. Maybe they're running low on disk space, or need smaller files for their mp3 player.
Intro: I for one got very tired of having to always type lame -b 128 etc, etc. into the terminal each time I wanted to change the quality of an mp3. Sure, there's http://www.media-convert.com/ , but that lags our internet. So I whipped up this script. Installation for Nautilus Installation for the default file manager in Ubuntu. 1) Download mp3Convert by downloading the attachment at the bottom of this post. (Alternatively, you can get the code right here: Code:
#!/bin/bash
quality=128
title=Converting
file=$@
if [ "$file" ]; then
cd `pwd`
lame -b $quality "$file" 2>&1 | awk -vRS='\r' '(NR>3){gsub(/[()%|]/," ");print $2; fflush();}' | zenity --progress --auto-close --auto-kill --title="$title" --text="$title $file at $quality kbps to $file.mp3"
fi
2) Open up a terminal (Applications > Accessories > Terminal) and put the script into ~/.gnome2/nautilus-scripts (the folder Nautilus checks to find any scripts): Code:
mv mp3Convert.sh ~/.gnome2/nautilus-scripts Code:
chmod 740 ~/.gnome2/nautilus-scripts/mp3Convert.sh Installation for Thunar Installation for the default file manager in Xubuntu. 1) Download mp3Convert by downloading the attachment at the bottom of this post. (Alternatively, you can get the code right here: Code:
#!/bin/bash
quality=128
title=Converting
file=$@
if [ "$file" ]; then
cd `pwd`
lame -b $quality "$file" 2>&1 | awk -vRS='\r' '(NR>3){gsub(/[()%|]/," ");print $2; fflush();}' | zenity --progress --auto-close --auto-kill --title="$title" --text="$title $file at $quality kbps to $file.mp3"
fi
2) Open up a terminal (Xfce Menu > Accessories > Terminal) and put the script into ~/.config/Thunar/actions (not needed, but it's a nice clean place to put it): Code:
mkdir -p ~/.config/Thunar/actions mv mp3Convert.sh ~/.config/Thunar/actions Code:
chmod 740 ~/.config/Thunar/actions/mp3Convert.sh a) Under the Basic tab: Name: mp3Convert.sh Command: ~/.config/Thunar/actions/mp3Convert.sh %f b) Under the Appearance Conditions tab: Put a checkmark next to Audio files. Click Ok and exit out of the actions manager. Now you can right click an mp3 file and go to mp3Convert.sh. Configuration By default it converts files to 128kbps, which I know isn't everyone's cup of tea. So you can edit ~/.gnome2/nautilus-actions/mp3Convert.sh (or ~/.config/Thunar/actions/mp3Convert.sh, depending on where you put it) by doing Code:
gedit ~/.gnome2/nautilus-actions/mp3Convert.sh and changing line 3 from Code:
quality=128 Code:
quality=192 Enjoy!
__________________
Last edited by picpak; January 2nd, 2008 at 10:46 AM.. |
|
|
|
|
|
#2 |
|
5 Cups of Ubuntu
![]() Join Date: Sep 2007
Location: Ann Arbor, MI
Beans: 19
Ubuntu 7.10 Gutsy Gibbon
|
Re: Script: Easily change quality of MP3 files
Is there a way to do this for Konqueror as well?
__________________
When I first started, it was hard finding Ubuntu applications to show the true extent of Linux and open development. An list with screenshots and videos would have made the process easier. See apps like GNOME Do and Brightside at The Daily Ubuntu. |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|