Why does my loop skip files or say No such file?
A while read loop gets its file names from stdin, and ffmpeg reads stdin too: it listens for key presses while it encodes. It eats the start of the next name, and the loop asks for a file that does not exist.
mkdir -p out; find . -name '*.mp4' -not -path './out/*' | while read f; do ffmpeg -i "$f" -vf scale=640:-2 "out/$(basename "${f%.mp4}").mp4"; done3 of the 5 files converted, in each of three runs. The other names reached ffmpeg with their leading . gone.
Add -nostdin and ffmpeg leaves stdin alone:
mkdir -p out; find . -name '*.mp4' -not -path './out/*' | while read f; do ffmpeg -nostdin -i "$f" -vf scale=640:-2 "out/$(basename "${f%.mp4}").mp4"; done5 of 5, every run.
A short job can finish before ffmpeg checks for keys, so a quick test hides the bug. Extracting MP3s from the same clips got all 5 without the flag. The re-encode, which runs longer, did not.



