Stooovie Posted April 5 Share Posted April 5 Hi, I made a simple audio-to-wav conversion workflow using ffmpeg (the entire command is ffmpeg -i {query} {query}.wav && exit How can I make it so it doesn't just append the .wav extension but actually changes it (so, from file.mp3 to file.wav and not file.mp3.wav)? Thanks! Link to comment
vitor Posted April 6 Share Posted April 6 Start by using with input as argv over with input as {query}. Then, quote your arguments or you’ll have a bad time spaces and the like. Finally: ffmpeg -i "${1}" "${1%.*}.wav" Note the && exit isn’t doing anything unless you have lines below that in your script. The explanation for the code above comes down to parameter substitution. When you have ${some_variable}, ${some_variable%.*} means “delete from some_variable any text from (and including) the last . to the end of the string”. Link to comment
Stooovie Posted April 6 Author Share Posted April 6 Just what I was looking for, thank you! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now