From a Julia program, run a ffmpeg shell command on a folder of files to make a mp4 movie

Presently I have a Julia script file that generates a folder of jpeg files.
Then I launch Windows PowerShell in that folder and execute my ffmpeg command such as:
ffmpeg -r 50 -start_number 10001 -i i_%5d.jpeg -c:v libx264 -crf 23 -pix_fmt yuv420p run_id_and_parameters.mp4

This works great but requires that I separately run my Julia program to generate the list of files. And then separately render the files into a movie using ffmpeg.

Is there a way to build my ffmpeg command (no problem) and then launch it from my Julia program?

Take a look at:

I’d recommend trying to use iterative encoding to build the video in place, which avoids the unnecessary round trip of JPEGs to & from your hard drive.
If you want to stick to your strategy of calling FFMPEG from the shell within Julia, see this old post: Creating a video from a stack of Images - #8 by stillyslalom

1 Like

Thank you very much for your suggestions. I will definitely investigate both options. It may take a little time as this will push my Julia expertise, which is good.

BTW: I’m just doing this for fun. I spent my 50 year career in scientific computing, primarily aerospace simulations. I’m playing with Mandelbrot & Filled Julia Sets. I started with Python and then switched to Julia for the incredible speed. High res frames with up to 9K iterations per pixel take less than a second. I’m getting 1e12 zooms before 64 bit limitations start to impact my plots. Thanks again.

1 Like