Posted: . At: 7:54 AM. This was 7 years ago. Post ID: 10402
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to record your Linux desktop to a video file using ffmpeg.


  1. Record your desktop to a video file
  2. Record your desktop with sound

Record your desktop to a video file

To record a good quality video of your Linux desktop, there are many ways to do this. The ffmpeg utility will be a natural choice for what we need. Run the command below to start recording a video.

localhost% ffmpeg -y -video_size 1600x900 -framerate 30 -f x11grab -i $DISPLAY+0,0 -c:v libx264 -qp 0 -preset ultrafast base.mp4

Just change the command to suit your desktop resolution. Then run this command to encode the video to the webm format for upload to a website.

localhost% ffmpeg -i base2.mp4 -c:v libvpx -qmin 0 -qmax 50 -crf 10 -b:v 2M output.webm

This may then be uploaded to the web. If it is embedded in a website, then Firefox can play it easily.

Here is a sample recording of my Gnome desktop.

Here is more information on recording webm files on Linux.

http://securitronlinux.com/bejiitaswrath/lovely-webm-i-made-with-ffmpeg/.

Record your desktop with sound

To record with internal sound easily, use the Simple Screen Recorder application. This is very good at recording a Linux desktop with no CPU impact. And with Pulseaudio, it will record internal sound, allowing a person to narrate the video without having to record sound separately, and mix it together in a video editor.

Install it like this.

4.4 Mon Feb 10 jason@Yog-Sothoth 0: $ sudo apt-get install simplescreenrecorder

Use default settings for sound, ensure your sound device is selected, and the sound will be recorded.

Simple Screen Recorder recording settings.
Simple Screen Recorder recording settings.

This is a very good program for documenting Linux tasks. I do not know why ffmpeg would not record audio, but this program is a very good solution for screen recording tasks. This program also supports recording OpenGL, this could possibly work for recording a game, but I am not totally sure about this, I have only tested desktop recording. But it is a perfect solution.


2 thoughts on “How to record your Linux desktop to a video file using ffmpeg.”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.