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
RamjiSamAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

amit_gCommented:
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`
RamjiSamAuthor Commented:
#!/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



RamjiSamAuthor Commented:
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
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

amit_gCommented:
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
RamjiSamAuthor Commented:
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?
amit_gCommented:
Change it to

#!/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"

if this doesn't work, add

set -x

before the line

inputfilename="$1"

and run it and post the results.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RamjiSamAuthor Commented:
#!/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



RamjiSamAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.