I have a surveillance camera and a program records videos when motion is detected. Basically, this program saves the video in a very heavy format.
My solution was to call a script that converts the video using ffmpeg. The script is called each time a video is made.
The conversion takes a relatively short time, but a lot of CPU use. The problem comes when a new video arrives to be converted and the conversion of the other hasn't finished. In that situation, the script is called again, resulting in two or more ffmpeg processes that make the machine almost hang during a considerable time.
How can I queue the conversion job, to be executed after the prior one is done? What I want is to have just one ffmpeg process at a time.