How to record Windows desktop with FFmpeg

By | March 24, 2016

It is desirable to record the desktop when automation is running unattended. When a test failed, the recording can be used for investigation. The easiest way to do that is to use FFmpeg. On Windows the recording can be started with the following command.

The recording is saved to the file named output.mp4. If there are too many tests and they take long time, you would want to limit the size of recording. You can adjust the video quality or frame rate. For example, the following command set frame rate to 10 frames per second.

For more information on capturing computer desktop with FFmpeg, see the link.

Now we can start the recording. The next question is how about stopping it? A couple of commands come into mind are

or

No, you can’t forcefully terminate FFmpeg process. It would leave an unreadable video file. FFmpeg should be terminated with a Control-C (SIGINT). There is no command available in Windows to do that. Luckily there is a GitHub project for that. The executable is named sendsignal.exe under the folder.

First, get the process ID.

Say, the process ID is 11040. Use the command to send a signal to FFmpeg process for graceful exit.

Update 9/4/2016: An improved sendsignal.exe is available here. This version allows users to use an executable name directly. To send Control-C to ffmpeg.exe, use

Leave a Reply

Your email address will not be published. Required fields are marked *