I am trying to loop recursively in all sub directories to process $i. This is all I have, any suggestions would be helpful!
for i in *.mov;
do
ffmpeg -i "$i" "${i%.*}.mp4";
Rm "$i" ;
done
CodePudding user response:
Assuming a GNU or similar userland, a way to process multiple files at the same time to speed things up:
find . -name "*.mov" -print0 | xargs -0 -n1 -P4 sh -c 'ffmpeg -i "$1" "${1%.*}.mp4" && rm "$1"' sh
Replace the 4 in -P4
with the number of conversions to run in parallel (which depends on how many cpu cores you have available).
Or to only process one file at a time, any find
:
find . -name "*.mov" -exec sh -c 'ffmpeg -i "$1" "${1%.*}.mp4" && rm "$1"' sh \{\} \;