LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-17-2008, 11:10 PM   #1
robteks
LQ Newbie
 
Registered: Jul 2008
Posts: 3

Rep: Reputation: 0
mp3 conversion using sox automate with cron


Hi, im trying to convert audio file from .gsm to .mp3 format using sox and lame to be use in asterisk. I created "Makefile" in the audio directory (you can see it below). When i type the command in the CLI it works but when I automate the task using cron it didnt work.

Cron:
* * * * * cd /path/to/my/dir; make mp3


Makefile:
DIRWAV = $(shell dir *.wav)
ALLWAV = $(DIRWAV:.wav=.mp3)
DIRGSM = $(shell dir *.gsm)
ALLGSM = $(DIRGSM:.gsm=.mp3)
mp3: $(ALLGSM) $(ALLWAV)
%.mp3: %.wav
nice lame --quiet -h --preset phone "$?" "$@"
rm -f "$?"
%.wav: %.gsm
nice sox "$?" -r 8000 -c 1 "$@"
rm -f "$?"

Last edited by robteks; 07-17-2008 at 11:12 PM.
 
Old 07-17-2008, 11:22 PM   #2
robteks
LQ Newbie
 
Registered: Jul 2008
Posts: 3

Original Poster
Rep: Reputation: 0
I take several test, configuring the cron to send me an email with the result of the 'make mp3' and heres what I got.

nice sox "get.gsm" -r 8000 -c 1 "get.wav"
rm -f "get.gsm"
nice lame --quiet -h --preset phone "get.wav" "get.mp3"
nice: lame: No such file or directory
make: *** [get.mp3] Error 127
rm get.wav


Its not creating .wav file and .mp3 but i know the command is working when i tested it in the cli. Any help and suggestion is appreciated.
 
Old 07-18-2008, 03:11 AM   #3
Vit77
Member
 
Registered: Jun 2008
Location: Toronto, Canada
Distribution: Mandriva, RHEL, Mageia, SuSE
Posts: 129

Rep: Reputation: 16
When using crontab, the PATH variable is absent.
So, specify the full path to lame and sox.

To get the full path use which lame

I hope it helps.
 
Old 07-18-2008, 03:46 AM   #4
robteks
LQ Newbie
 
Registered: Jul 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you Vit77 for the reply and yes it helps. Actually the PATH variable is not absent it uses the /usr/bin directory, so if i run the lame in the cron it becomes /usr/bin/lame which will not work, I noticed this when the old lame version installed through rpm is executed instead of the latest one which is under /usr/local/bin directory. So i have to change to its real path to work. Thanks.

Last edited by robteks; 07-18-2008 at 03:52 AM.
 
  


Reply

Tags
cron, lame, mp3, sox


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with wild card syntax to semi-automate file conversion using a perl script kmkocot Linux - Newbie 5 12-12-2007 01:55 PM
SoX File Conversion Issues pikk67 Linux - General 0 10-03-2006 07:38 AM
sox and mp3 encoding jjonas Linux - Software 1 06-09-2006 11:43 AM
trying to encode wav => mp3 with SOX, bitrate problems. salviadud Linux - Software 2 03-30-2006 02:18 AM
clean up and convert wav 2 mp3 with sox dibblethewrecke Linux - Software 1 12-04-2004 08:52 AM


All times are GMT -5. The time now is 04:30 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration