I am running a bash script to batch transcode videos on a LAMP server using find and ffmpeg
dir="/srv/videos"
for OUTPUT in "$(find $dir -iname *.AVI -o -iname *.MOV)"
do
ffmpeg -i "$OUTPUT" "${OUTPUT%%.*}.mp4" -hide_banner
done
ffmpeg returns an error if file has whitespaces
/srv/videos/file with white spaces.MOV: No such file or directory
For files without white spaces it works fine.
If I print the filenames inside quotes it looks as though it should be working
for OUTPUT in "$(find $dir -iname *.MOV)"; do echo "$OUTPUT";done
returns
/srv/videos/file with white spaces.MOV
What do I need to alter to avoid the error please?
EDIT added "" to ${OUTPUT%%.*}.mp4, I get the same error and corrected extension capitalisation (mov to MOV)