How to use FFMPEG to Convert Multiple Media Files At Once on Linux - Linux Tutorials - Learn Linux Configuration

Write a simple Bash script for FFMPEG batch file conversion.

This is a companion discussion topic for the original entry at

Thanks for ffmpeg batch scripts,
but I see too many times when people use “all At Once” or “simultaneously”, … when in fact these batch scripts actually and only convert media files serially, or consecutively, one at a time.
Now if, for example, you open multiple terminals, and then run ffmpeg in each terminal at the same time, then you’re converting multiple media files simultaneously/in parallel/concurrently.

Note: (for anyone who experienced running parallel ffmpeg batch scripts on different media files inside 3 different folders)?
I opened 3 xterms, inside 3 different folders, and then ran 3 different ffmpeg (libx265) batch scripts at the same time/in parallel.
I was amazed at just how fast these parallel encodes were going, and I thought that with my Ryzen 8C/16T cpu could handle doing this, but when all 3 batch scripts finished I had a small number of random media files that were corrupted.?

I don’t remember running into this issue using (parallel) ffmpeg libx264 encodes, but ONLY on parallel libx265 encodes.

BTW: I have latest Linux Mint 20.3 (Linux Kernel 13.*), with latest ffmpeg 5.0 and x265 build 3.5 (from Jan. 2022), and with latest MSI Motherboard Bios (NO overclocking).
The above parallel x265 encodes also randomly failed using ffmpeg 4.4 from last year.

Any advice ?
thanks ahead.