How to run a script recursively on files inside folders inside folders inside another folder?

You should be able to replace ls with find

find . -iname "*.mp4" | parallel ffmpeg -i {} -c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a alac {.}.mov

This one does work, but it instantly consumes my entire system RAM (32GB) and the whole pagefile. It proceeds to kill a lot of background processes complaining about “device memory full” and once it completes it generates a lot of 0 byte .mov files (more than half of all).

That is probably the impact of parallel. Try limiting the degree of parallelization with this:

find . -iname "*.mp4" | parallel ffmpeg -j 2 -i {} -c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a alac {.}.mov

That will only let 2 jobs run at the same time. You can change the number after -j if you want to run more than 2 at once.

1 Like
Unrecognized option 'j'.
Error splitting the argument list: Option not found

Oops, I put it in the wrong spot. Try this:

find . -iname "*.mp4" | parallel -j 2 ffmpeg -i {} -c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a alac {.}.mov
2 Likes

That did it. Thank you very much. I appreciate your time and patience. You too @Bink. You too @famewolf. You too @eso.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.