This article gives three command lines of ffmpeg as example to capture video + audio of your desktop screen in GNU/Linux. You may choose between three popular video formats: WKV, WEBM, or OGV. Just run the command line.

Subscribe to UbuntuBuzz Telegram Channel https://telegram.me/ubuntubuzz to get article updates directly.


The Basic


  • Press 'q' to stop ffmpeg processing.
  • You will start ffmpeg command, and then ffmpeg will show line by line output continuously, and then you start moving your cursor and speaking, and then go back to ffmpeg terminal pressing 'q' to end the recording.
  • Check your $HOME directory for the video file result.

They are the basic things in using ffmpeg command line to record desktop.

Format Choices


These three video formats mentioned in this article (.mkv, .webm, .ogv) are ready for YouTube.  

1) Record Video + Audio to MKV Format



ffmpeg -video_size 1366x768 -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i default myvideo_$(date +%d_%B_%Y_%H:%M).mkv


2) Record Video + Audio to WEBM Format


ffmpeg -video_size 1366x768 -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i default -vcodec vp8 -acodec libvorbis myvideo_$(date +%d_%B_%Y_%H:%M).webm


3) Record Video + Audio to OGV Format


ffmpeg -video_size 1366x768 -framerate 6 -f x11grab -i :0.0 -f pulse -ac 2 -i default -codec:v libtheora -qscale:v 7 -codec:a libvorbis -qscale:a 5  myvideo_$(date +%d_%B_%Y_%H:%M).ogv

The Results


Here are the three video files created by performing those three commands.


Further References


I used these references to find the best commands for me.


, , , ,