I'm trying to run a for
loop in cmd that looks like this:
for %f in (*.mp4) do (
set outfile=%f:mp4=mp3%
ffmpeg -i %f -vn -ar 44100 -ac 1 -b:a 32k -f mp3 %outfile%
)
The script is supposed to grab all *.mp4 files, run the ffmpeg command on them, then name the resultant file identical as the mp4 with only the extension changed to *.mp3.
It doesn't work. The output is literally named %outfile%
. If I had to guess, there's something wrong with the initialization or calling of the outfile
variable. I also thought that perhaps it is a data type issue. %f
is perhaps a pointer, not a string, so some kind of string extraction or type conversion is needed.
How can I set and use a filename as a string variable in cmd?