Lossless recording of your desktop

Every day solutions to every day challenges. + Brilliant stuff

Moderators: b1o, jkerr82508

Forum rules
Please feel free to post your tip it does not have to be advanced. Also ask questions directly related to the tip here. But do not start new threads with questions or ask for help here. That is what the help section is for. forum rules: http://bjoernvold.com/forum/viewtopic.php?f=8&t=568
User avatar
Posts: 9171
Joined: 14 Mar 2010, 16:34

Lossless recording of your desktop

Postby viking60 » 28 May 2016, 00:11

If we want to brag about our Desktop with fancy Compiz effects on youtube then we have our work cut out to record it.

I have had tearing in with my Nvidia card and when I use fancy GUI recorders the quality can be poor.

There is a Nvidia bug that causes tearing and SimpleScreenRecorder offers to fix it first time you start it.

So do that; install and start SimpleScreenRecorder and accept the offer - then you can close it.

Next install ffmpeg it will be in your repos.

Then you go to a terminal and check your resolution:

Code: Select all


This will list your possible resolutions and the one you are using has a * behind it (probably the one on top).
Something like this:

Code: Select all

Screen 0: minimum 8 x 8, current 1920 x 1200, maximum 8192 x 8192
DVI-I-0 disconnected (normal left inverted right x axis y axis)
DVI-I-1 disconnected (normal left inverted right x axis y axis)
TV-0 disconnected (normal left inverted right x axis y axis)
DVI-I-2 disconnected (normal left inverted right x axis y axis)
DVI-I-3 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
   1920x1200     59.95*+
   1680x1050     59.95 
   1600x1200     60.00 
   1280x1024     75.02    60.02 
   1280x960      75.00 
   1024x768      75.03    60.00 
   800x600       75.00    60.32 
   640x480       75.00    59.94 

As you can see; my resolution is 1920x1200 so I am going to use that below.

So far so good - now we are ready to do our lossless recording; type this in your terminal:

Code: Select all

ffmpeg -video_size 1920x1200 -framerate 30 -f x11grab -i :100.0 -c:v libx264 -qp 0  -preset ultrafast mymovie.mkv

This is going to record your desktop and save it to mymovie.mkv (use your resolution - not mine)

To stop the recording simply press q (for quit) in the terminal - I use drop down terminals for this.

Now go to the folder and click on mymovie.wmk and it will play in your media player.

You can upload the file directly to youtube but to save time you can shorten it down a bit without loosing quality - like this:

Code: Select all

ffmpeg -i mymovie.mkv -c:v libx264 -qp 0 -preset veryslow my_smaller.mkv

This step is optional.
And you will be blessed with a nice video of your desktop:

And here is the trick - you will never remember the command for recording so make an alias of it:

Code: Select all

alias makemovie='ffmpeg -video_size 1920x1200 -framerate 30 -f x11grab -i :0.0 -c:v libx264 -qp 0  -preset ultrafast capture.mkv'

So now you simply have to type

Code: Select all

to produce your movie (again: use your resolution - not necessarily 1900x1200) .

It is as simple as that! +1
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

Return to “Tips & Tricks”