I have a directory with several subdirs which contain .flac
files. I want to batch convert them to .mp3
. The path names contain spaces. Now I want to do something like this
find . -type f -regex .*.flac -exec ffmpeg -i {} -c:a mp3 -b:a 320k \;
But the question is, how can I use {}
and substitute flac
for mp3
to give ffmpeg an output file name? In bash, one could use variable substitution ${file%.flac}.mp3
, but I cannot apply this here. sed
-based approaches don't seem to work with find
either.
Is there any simple solution to this?