I'm trying to convert all wav and mp3 files to ogg files recursively with find and FFmpeg. I have made the following bash script to do so:
#!/usr/bin/env bash
# Converts samples to ogg
find samples \( -iname '*.wav' -o -iname '*.mp3' \) -execdir ffmpeg -i "$(basename "{}")" -qscale:a 6 "${$(basename "{}")%.*}.ogg" \;
This however errors in:
${$(basename "{}")%.*}.ogg: bad substitution
How would I need to format the last substitution to make it give back the basename of the file suffixed with .ogg
, and why does this not work?