nestor.rueda No hay comentarios

Star-CCM+: Creating a video from a set of pictures using ffmpeg

Star-CCM+ allows you to generate a collection of pictures from a scene during a transient run. The challenge appeared when I wanted to generate a video from these pictures. Below is a short summary of one of the possible ways to generate a video (the easiest for me).

Pre-requisites: Ubuntu bash in Windows (assuming you’re in Windows).

  • make sure you have ffmpeg installed, if not just run sudo apt install ffmpeg
  • Navigate to the directory where your pictures are stored and run the following command:

ffmpeg -framerate 24 -pattern_type glob -i ‘*.png’ -c:v libx264 -pix_fmt yuv420p output.mp4

A short explanation below:

-framerate: frames per second (default is 25)
-pattern_type glob: wildcars 🙂 Essentially recognized any “png” within the same dir. Luckily Star-CCM+ correctly names your files in appropriate order so you don’t have to worry about the sequence.
and finally file name, mp4 in this case.