Link to home
Start Free TrialLog in
Avatar of RamjiSam
RamjiSam

asked on

Linux Shell Command Help

Im Using Command To search mp4 Files in  directory and the directories below and it should convert mp4 files into 3gp.. output directtory  shld be same

find . -name "*.mp4" -exec convert.sh {} \;

#!/bin/bash
rm -f tmp.3gp
ffmpeg -i  "$1" -s 352x288  -vcodec h263 -acodec libfaac -ac 1 -ar 8000 -r 25 -ab 32k tmp.3gp && mv tmp.3gp "$1"
#

i Used This Command But Its Not Working

Waiting For Expert Answer
Avatar of amit_g
amit_g
Flag of United States of America image

What do you mean by "Its Not Working"? Do you get any error? Have you tested convert.sh without the find?

The command in the convert.sh would move the converted file back to same file i.e. AnyFile.mp4 would get converted to tmp.3gp and then tmp.3gp would get moved back to AnyFile.mp4. You most likely you meant


ffmpeg -i  "$1" -s 352x288  -vcodec h263 -acodec libfaac -ac 1 -ar 8000 -r 25 -ab 32k tmp.3gp && mv tmp.3gp `basename "$1" .mp4`
Avatar of RamjiSam
RamjiSam

ASKER

#!/bin/bash
rm -f tmp.3gp
ffmpeg -i  "$1" -s 352x288  -vcodec h263 -acodec libfaac -ac 1 -ar 8000
-r 25 -ab 32k tmp.3gp && mv tmp.3gp `basename "$1" .mp4`
#
 I Used This  By find . -name "*.mp4" -exec convert.sh {} \;

Im Getting Error
Must supply at least one output file
/home/public_html/test2/convert.sh: line 4: -r: command not found



I Used This Command

ffmpeg -i video.mp4 -s 352x288  -vcodec h263 -acodec libfaac -ac 1 -ar 8000 -r 25 -ab 32k -y video.3gp

Its Working One

When I Use In Shell This Command Is Not Working
Ues this

#!/bin/bash

inputfilename="$1"
outputfilename=${inputfilename%\.*}.3gp

ffmpeg -i $inputfilename -s 352x288  -vcodec h263 -acodec libfaac -ac 1 -ar 8000 -r 25 -ab 32k -y $outputfilename
After Trying
#!/bin/bash

inputfilename="$1"
outputfilename=${inputfilename%\.*}.3gp

ffmpeg -i $inputfilename -s 352x288  -vcodec h263 -acodec libfaac -ac 1 -ar 8000 -r 25 -ab 32k -y $outputfilename

Im Getting This Error


./50: no such file or directory
/home/tamilmob/public_html/test2/convert.sh: line 7: -ar: command not found

The Directory Name Is 50 cent

But It Take Only 50 so it says no such directory

Do We Need To Change Anything In Code?
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
#!/bin/bash
set -x
inputfilename="$1"
outputfilename="${inputfilename%\.*}.3gp"

ffmpeg -i $inputfilename -s 352x288  -vcodec h263 -acodec libfaac -ac 1 -ar 8000 -r 25 -ab 32k -y "$outputfilename"
#
I Tired Finally im getting this error

ffmpeg: missing argument for option '-ac'

/home/test2/convert.sh: line 7: 1: command not found



hai

its working for me now.. i had a space character in middle of code.. so it showed error before...


thanks amit_g... Good Job