ben
Registered
- Joined
- Feb 17, 2011
- Messages
- 1,868
- Likes
- 2,268
Hi, from recent threads it's become clear we have some experts in Mac hardware out there - let's see if someone can give a hand with software.
I need some help with text variable handling. Specifically, I am looking to put together a bash script that will allow me to drag and drop a file onto the script icon, which will invoke ffmpeg, convert the file to a different sound format, and leave the outputted file in the same location as the original, and with the same name - but a different extension.
I now have aDOS Windows bat file that does this, which means that to get this particular task done, I need to switch into Windows. I normally have Parallels running, which means I can download the file, move over to Windows, access the file I've just downloaded on the macOS side, and once the job is done, it's on the Mac in the same folder as before - but I'd still much rather have something I could run on the Mac itself.
Here's the relevant code from my batch file:
This takes the name of the input file (which I've dragged onto the program shortcut), makes a new variable with the same name but replacing the extension "m4a" with "wav", and directs ffmpeg to convert the m4a file to wav (PCM mono, 8000, 16) and assign thereto the new variable as a filename.
Anybody knows how to do this in bash? Checked Stack Overflow et al with no success. Maybe some resident nerds here?
Thanks all!
I need some help with text variable handling. Specifically, I am looking to put together a bash script that will allow me to drag and drop a file onto the script icon, which will invoke ffmpeg, convert the file to a different sound format, and leave the outputted file in the same location as the original, and with the same name - but a different extension.
I now have a
Here's the relevant code from my batch file:
Code:
set Input="%1"
set Output="%Input:m4a=wav%"
ffmpeg -i "%Input%" -acodec pcm_s16le -ac 1 -ar 8000 %Output%
This takes the name of the input file (which I've dragged onto the program shortcut), makes a new variable with the same name but replacing the extension "m4a" with "wav", and directs ffmpeg to convert the m4a file to wav (PCM mono, 8000, 16) and assign thereto the new variable as a filename.
Anybody knows how to do this in bash? Checked Stack Overflow et al with no success. Maybe some resident nerds here?
Thanks all!