LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-16-2006, 02:59 PM   #46
lilman1
LQ Newbie
 
Registered: Dec 2006
Posts: 4

Rep: Reputation: 0

were do i enter the code
 
Old 12-16-2006, 03:00 PM   #47
lilman1
LQ Newbie
 
Registered: Dec 2006
Posts: 4

Rep: Reputation: 0
how can i change my mp4 into a mp3
 
Old 12-16-2006, 03:01 PM   #48
lilman1
LQ Newbie
 
Registered: Dec 2006
Posts: 4

Rep: Reputation: 0
how can i change my mp4 song into a mp3 song
 
Old 12-17-2006, 10:02 PM   #49
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Linux Mint 21.3 Cinnamon
Posts: 359
Blog Entries: 1

Rep: Reputation: 31
Very good idea. I added it myself.
 
Old 12-17-2006, 10:07 PM   #50
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Linux Mint 21.3 Cinnamon
Posts: 359
Blog Entries: 1

Rep: Reputation: 31
Mr.Lliman1 you will need basic computer knowledge to use a simple script.

This thread is about a script to convert m4a files to mp3.

If you want to convert mp4 songs then the script is the same but I would change the content as followed:

#!/bin/bash
#
# mp4 to mp3 and tag transfer
# for music from iPod

# This software is licensed under the GNU General Public License
# For the full text of the GNU GPL, see:
#
# http://www.gnu.org/copyleft/gpl.html
#
# No guarantees of any kind are associated with use of this software.

#requirements: faad, lame

#Begin
clear

# variables
version=0.1a

current_directory=$( pwd )

for i in *.mp4
do
faad "$i"
x=`echo "$i"|sed -e 's/.mp4/.wav/'`
y=`echo "$i"|sed -e 's/.mp4/.mp3/'`
faad -i "$i" 2>.trackinfo.txt
sed -i '23s/unknown: /title: /' .trackinfo.txt
sed -i '24s/unknown: /artist: /' .trackinfo.txt

year=` grep '^unknown:[[:space:]]*[[:digit:]]*[[:space:]]*$' .trackinfo.txt|sed -e 's/unknown: //'`
sed -i 's/^unknown:[[:space:]]*[[:digit:]]*[[:space:]]*$/year: /' .trackinfo.txt

#If you get year problems use this instead
#year=`grep 'date: ' .trackinfo.txt|sed -e 's/date: //'`

sed -i 's/unknown: iTunes/iTunes: iTunes/' .trackinfo.txt

genrecount=`grep -c 'genre: ' .trackinfo.txt`
unknowncount=`grep -c 'unknown: ' .trackinfo.txt`

if [ "$genrecount" -eq 1 ] && [ "$unknowncount" -eq 2 ]; then
sed -i '25s/unknown: /composer: /' .trackinfo.txt
sed -i '26s/unknown: /album: /' .trackinfo.txt
genre=`grep 'genre: ' .trackinfo.txt|sed -e 's/genre: //'`
fi

if [ "$genrecount" -eq 1 ] && [ "$unknowncount" -eq 1 ]; then
sed -i '25s/unknown: /album: /' .trackinfo.txt
genre=`grep 'genre: ' .trackinfo.txt|sed -e 's/genre: //'`
fi

if [ "$genrecount" -eq 0 ] && [ "$unknowncount" -eq 3 ]; then
sed -i '25s/unknown: /composer: /' .trackinfo.txt
sed -i '26s/unknown: /album: /' .trackinfo.txt
sed -i '27s/unknown: /genre: /' .trackinfo.txt
genre='other'
fi

if [ "$genrecount" -eq 0 ] && [ "$unknowncount" -eq 2 ]; then
sed -i '25s/unknown: /album: /' .trackinfo.txt
sed -i '26s/unknown: /genre: /' .trackinfo.txt
genre='other'
fi

title=`grep 'title: ' .trackinfo.txt|sed -e 's/title: //'`
artist=`grep 'artist: ' .trackinfo.txt|sed -e 's/artist: //'`
album=`grep 'album: ' .trackinfo.txt|sed -e 's/album: //'`
track=`grep 'track: ' .trackinfo.txt|sed -e 's/track: //'`

lame --alt-preset 192 --id3v2-only --tt "$title" --ta "$artist" --tl "$album" --tg "$genre" --tn "$track" --ty "$year" "$x" "$y"
rm .trackinfo.txt
rm "$x"
mv "$y" "$artist - $title - $album.mp3"
rm "$i"
done

#If you get bad characters errors use this instead
#rm "$x"
#artist=`echo $artist | sed -e 's/\//_/'`
#mv "$y" "$artist - $title.mp3"
#rm $i
#done
 
Old 12-29-2006, 05:29 PM   #51
scotth20
LQ Newbie
 
Registered: Dec 2006
Posts: 1

Rep: Reputation: 0
script to convert m4a, wma or ogg to mp3

This script will convert all files with the given extension to mp3 files:

usage tomp3.sh wma (converts all wma files to mp3)
This script needs mplayer, lame and transcode to work, so you will
need the appropriate packages.

Just put this in your executable path somewhere....

-------------------------------------------------------------
remove_spaces=1

tmp_file="/tmp/pcm_audio"

function rm_spaces() {
mv "$1" `echo $1 | tr ' ' '_'`
}

function tomp3() {
ext=$1

for i in *.$ext
do
if [ -f "$i" ]; then
dest=`basename "$i" .$ext`

if [ "$ext" = "ogg" ]; then
echo "Encoding $i to "$dest".mp3"
transcode -q 0 -i "$i" -o "$dest" -y null,lame 2>/dev/null
else
rm -f "$tmp_file"
mkfifo "$tmp_file"

#echo "Ripping $i"
mplayer -quiet -vo null -vc dummy -af volume=0,resample=44100:0:1 -ao pcm:waveheader:file="$tmp_file" "$i" &>/dev/null &

echo "Encoding $i to "$dest".mp3"
lame --quiet -m s -h -b 192 -V0 --vbr-new "$tmp_file" "$dest".mp3

# remove temp file
rm -f "$tmp_file"

fi
# remove spaces
if [ $remove_spaces -eq 1 ]
then
rm_spaces "$dest".mp3
fi
fi
done

echo "done."
}

case "$1" in
ogg)
tomp3 ogg
;;
wma)
tomp3 wma
;;
m4a)
tomp3 m4a
;;
*)
echo "Usage: tomp3.sh m4a|wma|ogg"
exit 1
esac

exit 0
 
Old 01-24-2007, 01:39 PM   #52
josephmc
LQ Newbie
 
Registered: Feb 2004
Location: Texas
Distribution: Arch Linux, Ubuntu
Posts: 5

Rep: Reputation: 0
great script! you don't really need to move the files at the end. i just let the filename stay the same. if you do change it you need to make sure trakes < 10 have a 0 in front of it for sorting. has ANYBODY found a real configurable script for the written in perl or something of the like?
 
Old 01-25-2007, 07:46 AM   #53
ungua
Member
 
Registered: Oct 2004
Location: bergen, norway
Distribution: OpenSuSe (SuSe 10.1), Win XP Pro
Posts: 539

Rep: Reputation: 30
i haven't tried the script yet, but would like to do that soon. still, i'd prefer a program with interface. can anyone provide that!?

regards
ungua
 
Old 02-19-2007, 11:14 AM   #54
scm86
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora Core 5 2.6.16-1.2133_FC5smp
Posts: 96

Rep: Reputation: 15
If you haven't used one of the scripts yet, you should try the first one. There is no need for a GUI, all you have to do is fire up the script and let it crawl through your files, making them into mp3's.

I had to modify the script to get it to transcode my m4a's, but that was a 30 second find/replace with kwrite, otherwise is the exact same as was posted above.

http://mlinks.net/~scottm/m4a_to_mp3.sh

To use it:
0) Save the file above.
1) Place it in the same folder as the audio files you wish to transcode, or copy them into the folder containing the script.
2) From a terminal as normal user: chmod +x m4a_to_mp3.sh
3) Still in the terminal: ./m4a_to_mp3.sh
4) Sit back and watch, then enjoy your mp3's.

Note that this does replace the m4a files, so if you want to keep them as m4s'a as well, backup them up somewhere.

Hope this helps someone, the script was really handy to me!

Scott McNeely

Last edited by scm86; 02-19-2007 at 11:17 AM.
 
Old 07-07-2007, 03:58 AM   #55
sblob
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Rep: Reputation: 0
SteelJ, thank you very much for all of the time that you spent on the script. I have used it for the basis for another script which handles recursively walking a directory and alternative directory names. If anyone is interested I have posted it:
(sorry I would have posted it here but it got very long)
 
Old 07-07-2007, 03:58 AM   #56
sblob
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Rep: Reputation: 0
(Sorry about the double post, limitation of the site prevented me from posting the URL)

SteelJ, thank you very much for all of the time that you spent on the script. I have used it for the basis for another script which handles recursively walking a directory and alternative directory names. If anyone is interested I have posted it:
http://www.minigeek.org/index.php/20...ript/#more-116

(sorry I would have posted it here but it got very long)

Last edited by sblob; 07-07-2007 at 04:00 AM. Reason: fixed URL
 
Old 07-07-2007, 07:18 PM   #57
Steel_J
Member
 
Registered: Oct 2004
Location: Montreal, Canada
Distribution: Linux Mint 21.3 Cinnamon
Posts: 359
Blog Entries: 1

Rep: Reputation: 31
Thanks man,

I dowloaded it and will use this one instead of the old one.
 
Old 07-08-2007, 08:58 AM   #58
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Quote:
Originally Posted by sblob
(Sorry about the double post, limitation of the site prevented me from posting the URL)
Feature of the site. It is by design rather than by accident.
 
Old 10-22-2007, 09:41 PM   #59
love mp3
LQ Newbie
 
Registered: Oct 2007
Posts: 1

Rep: Reputation: 0
I have used a similar tool called M4A to MP3 Converter whihc work on windows, but not on linux.
 
Old 11-27-2007, 04:45 AM   #60
hoodooman
Member
 
Registered: Oct 2006
Location: Stirling in Scotland
Distribution: Slackware 13.37 64 bit
Posts: 297

Rep: Reputation: 42
You could just install libmp4 and ecasound.If you want to convert to .mp3 just run in the folder containing the files ecaconvert .mp3 *.mp4.Simple.Change the .mp3 to .wav .flac .ogg depending on what output you need.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
converting .ogg to .mp3? servnov Linux - General 8 03-06-2014 03:21 PM
converting m4u to mp3? minm Linux - Newbie 6 10-06-2005 02:26 PM
converting wma to mp3 rolanaj Linux - Software 2 08-16-2003 03:46 PM
Converting mp3 to ogg qanopus Linux - Software 8 07-07-2003 12:58 AM
Converting mp3 to wav. ??? rayflynn Linux - General 2 12-11-2001 05:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration