I have a bash script that I created to process videos from within a folder and it's subfolders:
find . -type f -name '*.mkv' | while read file;
do
ffmpeg -i $file ...
done
The problem: Instead of the while loop waiting ffmpeg to complete, it continues iterate through the loop. The end result is, files not getting processed. I need a way to have the current while loop iteration to wait until ffmpeg is complete before continuing to the next. Or alternatively a way to queue these items.
Edit: So The solution when iterating over a set of files is to pass the -nostdin param to ffmpeg. Hope this helps anyone else who might have a similar issue.
Also file --> $file was a copy/paste typo.
&at the end of theffmpegcommand?&at the end of the line. Do you get any error messages? Try prefacing the inner command with "echo" and adding a sleep 1 after it, to verify that the loop itself doesn't have issues. For example, in the command line you give, you're usingfileinstead of$file-nostdinoption toffmpeghelp? It might be reading all the rest of the input to the while-loop.