Fedora Linux Support Community & Resources Center
  #1  
Old 17th December 2011, 10:12 PM
AndrewSerk Offline
Registered User
 
Join Date: Oct 2010
Posts: 889
linuxfirefox
Bash script, ffmpeg batch help needed

Hello and thank you for taking the time to read my post.

I am having issues with a bash script to batch process a folder. The following works fine with simple names:
Code:
for i in *.mp3; do ffmpeg -i $i -vol 500 ${i%.mp3}.mp3; done
But if the name has spaces and special characters like: "13_2 - All The Way (Duet With Frank Sinatra)" the script fails.

So the question is how do I "properly" include all the special characters and spaces in my globular "*.mp3"??


Thank you in advance,

Andrew

Last edited by AndrewSerk; 17th December 2011 at 10:32 PM.
Reply With Quote
  #2  
Old 17th December 2011, 11:15 PM
smr54 Online
Registered User
 
Join Date: Jan 2010
Posts: 5,523
linuxchrome
Re: Bash script, ffmpeg batch help needed

I'm usually able to manage it with


for i in *.mpg3;do ffmpeg -i "$i" -vol 500 "$"{i%%.mp3}".mp3;done

Or similar. Main point being put the first "$i" in quotes and the second $"{iWhatever}" in quotes as well.

I just tried, after reproducing that mp3 name.
Code:
for i in *.mp3; do mv "$i" "${i%%.mp3}".1mp3;done
(I didn't have the actual mp3 and so just touched a file with the name, as well as my test.mp3, then renamed them.)

ls *mp3
13_2 - All The Way (Duet With Frank Sinatra).1mp3 my test.1mp3

Last edited by smr54; 17th December 2011 at 11:18 PM.
Reply With Quote
  #3  
Old 17th December 2011, 11:23 PM
AndrewSerk Offline
Registered User
 
Join Date: Oct 2010
Posts: 889
linuxfirefox
Re: Bash script, ffmpeg batch help needed

Thank you Scott,
I just added the " " 's like you said and it worked perfectly.
Code:
for i in *.mp3; do ffmpeg -i "$i" -vol 500 "${i%.mp3}".mp3; done
Thank you again,

Andrew
Reply With Quote
  #4  
Old 18th December 2011, 12:02 AM
smr54 Online
Registered User
 
Join Date: Jan 2010
Posts: 5,523
linuxchrome
Re: Bash script, ffmpeg batch help needed

My pleasure, glad it was an easy fix.
Reply With Quote
Reply

Tags
bash, batch, ffmpeg, needed, script

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash Script Needed! CraigWatson Programming & Packaging 3 3rd September 2010 07:53 PM
[SOLVED] bash script help needed please snoopo71 Using Fedora 4 27th June 2010 01:10 PM
Batch Converting Files with BASH Starclopsofish Using Fedora 1 10th February 2009 12:00 PM
ffmpeg shell script help HaydnH Using Fedora 2 18th October 2007 04:05 PM
Convert bash script to perl script homey Programming & Packaging 1 2nd September 2006 04:24 AM


Current GMT-time: 03:45 (Tuesday, 21-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Sakura - Bikin - Konongo Travel Photos on Instagram