Execute "ffmpeg" command in a loop
bash, ffmpeg
Solution
No reason for find, just use bash wildcard globbing
#!/bin/bash
for name in *.wav; do
ffmpeg -i "$name" -ab 320k -ac 2 "${name%.*}.mp3"
done
Problem
I have three `.wav` files in my folder and I want to convert them into `.mp3` with ffmpeg. I wrote this bash script, but when I execute it, only the first one is converted to mp3. What should I do to make script keep going through my files? This is the script: ``` #!/bin/bash find . -name '*.wav' | while read f; do ffmpeg -i "$f" -ab 320k -ac 2 "${f%.*}.mp3" done ```