Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have .m4a audio files that I can play in mplayer with no problem, but cannot with xmms version 1.2.7. Is there a way to use mplayer to convert the m4a file to mp3? Or any other progrram to convert? Thanks for the help.
Mplayer is all I could find to do it.
In fact, I did this conversion yesterday.
Put all the .m4a files into one directory
then write a quick script.
Code:
#!/bin/bash
#
# Dump m4a to wav (first step in conversion)
for i in *.m4a
do
mplayer -ao pcm "$i" -aofile "$i.wav"
done
That will use mplayer do dump m4a into a regular wave file.
Next, you need to use lame to convert the .wavs into .mp3s. You could use oggenc if you wanted .oggs.
Code:
#!/bin/bash
#
#Second step... use lame to convert into .mp3
for i in *.wav
do
lame -h -b 192 "$i" "$i.mp3"
done
That's it. you've got all your files as mp3s.
However.. the file will look like "filename.m4a.wav.mp3"
So, to clean that up we use...
Code:
#!/bin/bash
#
# Remove extrenuous extensions.
for i in *.mp3
do
x=`echo "$i"|sed -e 's/m4a.wav.mp3/mp3/'`
mv "$i" "$x"
done
There you go.
I suppose these could all be combined into one script, but i wanted to take it one step at a time when I did it yesterday.
You could change the mv "$i" "$x" to a cp command instead, if you want to be safe.
I am a real newbie on redhat 9 and I have some basic questions. I saved all three of these scripts as
step1.script
in a 'scripts' file in my home directory. How do I invoke these scripts to act upon the m4a files ( which are all in a directory called 'itunes' )?
Also, how do I point the scripts( do I even need to point them?) to act on the directory with the m4a files?
Do I need to be in the 'itunes' directory to do this?
I thought I might have to just type the script file path and name and 'boom' it would work but I got 'access denied'. Then, I tried it from root and still the same thing. Also preceded it with
exec step1.script
but no success.
If anybody could explain anything further regarding these scripts and how to execute them (do I use the exec command?) , that would be helpful. Thanks.
have to be there? Does is work like a command or isi t helping declare the path to the scripts?
I am wondering also, in the three scripts in the thread above, if the scripts automatically search for the directory with m4a files or if it is assuming the user is running the scripts while the user is in the directory that is to be effected--the directory with the m4a files. Any comments.
Also, if my script is located in
mycomputer/home/scripts
...and my m4a files are located in
mycomputer/home/music/iTunes
...how would these scripts look to work right?
I think I am almost there. Let's hope my mplayer is configured right to work...also, I am using RH 9.
First off, thank you very much to Shade for that script. I have been fooling around with different scripts to convert these files without success.
Quote:
Does the . in ./script1 have to be there? Does is work like a command or isi t helping declare the path to the scripts?
I am wondering also, in the three scripts in the thread above, if the scripts automatically search for the directory with m4a files or if it is assuming the user is running the scripts while the user is in the directory that is to be effected--the directory with the m4a files. Any comments.
Also, if my script is located in mycomputer/home/scripts ...and my m4a files are located in mycomputer/home/music/iTunes ...how would these scripts look to work right?
As long as the script is in your PATH you can execute it as that user anywhere your permissions allow, I put my scripts in /home/user/bin which is in my path. You can execute that script by typing its name w/o the ./ in your music directory where the .m4a files are located. You would have to change the script to search through directories and I don't know how to do that, yet. Thanks again to Shade.
#!/bin/bash
#
# Dump m4a to mp3
for i in *.m4a
do
if [ -f $i ]; then
rm -f "$i.wav"
mkfifo "$i.wav"
mplayer -ao pcm "$i" -aofile "$i.wav" &
dest=`echo "$i"|sed -e 's/m4a$/mp3/'`
lame "$i.wav" "$dest"
fi
done
Oh yes baby! XD
Nobody wants a 400 megabyte .wav file for every one of their m4a/mp3 files. u.u
These scripts work great, but what if I wanted to save all my m4a tags, then automatically reapply them to the new mp3/ogg? Any suggestions?...I'm sure there are programs out there that do a wonderful job, but a bash or perl script would be saweet!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.