This can be done with the next command:
1 | $ ffmpeg -r 50 -s 1280x720 -f x11grab -i :0.0 -vcodec msmpeg4v2 -qscale 1 output_filename.avi |
Explanation of this command is shown below.
1 | $ ffmpeg -r 50 |
The frame rate in which you want to record, in this example 50 frames per seconds is used.
1 | -s 1280×720 |
The screen resolution that you want to record.
Do not try to use a larger screen size than your desktop screen size.
1 | -f x11grab |
This flag is used to tell ffmpeg to record the x11 window.
1 | -i :0.0 |
Here the special input file is an x11 screen buffer.
In this case, we record the default window 0.
You can also record another active x11 server window like -i :1.0.
If x11 server window is active the screen will be black.
1 | -vcodec msmpeg4v2 |
We prefer to use one of the encoder msmpeg4v2 ( Microsoft MPEG4-v2 codec).
1 | -qscale 1 |
This sets the quality of the file to highest (in this case is 1).
1 | output_filename.avi |
The file name for the output file.