I have this bash script for converting .mp4 video to .mp3 audio.
It runs, but does the loop only once, though there are more mp4 files in /home/myname/mp4dir.
The script converts the first .mp4 file it finds to .mp3, unless there is already an .mp3 file. This should be done in a loop, but after the first call to ffmpeg the script stops.
Why?
#!/bin/bash
find /home/myname/mp4dir -name "*.mp4" | while read f
do
        fOut=`echo $f | sed s/mp4/mp3/`
        echo "convert $f => $fOut"
        if ! test -f $fOut
        then
                ffmpeg -i $f -vn -f mp3 $fOut
        fi
done

echo $f?bash -x youscript.sh? Does theffmpegcommand complete?bash -x youscript.shthe loop executes more than once; the output of several ffmpeg calls shows. What's the difference?