Screen capture video and sound on Ubuntu

There are a couple of ways you can do a screen capture on Ubuntu. The problem is that most of the integrated graphical user interfaces are either not stable and crash in the middle of recording, or are not using proper codecs thus creating huge files, which one has to convert in order to edit or publish.

I'll share the two basic and reliable tools I'm using: Simple Screen Recorder and manually recording via FFmpeg:
For the Simple Screen Recorder is notable that it has pause shortcuts as well as one can adjust its various options very easily.
Image: screenshot.png
Installation:
sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder
sudo apt-get update
sudo apt-get install simplescreenrecorder
Afterward, just start using the program.

The second option is to manually record your screen. The first step is to install FFmpeg
sudo apt-get install ffmpeg
 Then create capture.sh file with
sudo nano capture.sh
and place the following information inside. Contents of the screen recorder:
#!/bin/sh
#
REC_iface=$(pactl list sources short | awk '{print$2}')
SCREEN_res=$(xrandr -q --current | grep '*' | awk '{print$1}')
REC_iface=alsa_input.usb-Superlux_digit_Superlux_E205U-00.analog-stereo
ffmpeg -async 1 -threads auto -f pulse -i $REC_iface -ac 2 -acodec vorbis -f x11grab -thread_queue_size 1024 -r 15 -s $SCREEN_res -i :0.0 -vcodec libx264 -crf 36 -preset slow -pix_fmt yuv420p  screencast.mp4
the only thing you need to change in this file is the REC_iface, this is your microphone input which you can find with the command:
pactl list sources short
Afterward, give chmod +x capture.sh to the file to make it executable.

then start the capturing process:
./capture.sh
this will start the recorder. Wait 5 seconds and start your screencast. When ready just click CTRL+C to stop the recording.

Cheers!
Author Photo

About Nevyan Neykov

I do web design and development for more than 15 years. Have been working in various companies dealing mainly with PHP and JavaScript. Independently as well as in teams, I am involved in design and development of user friendly websites. Exploring the new aspects of JavaScript language such as ES6, as well as the Angular framework and how to apply them in practice. Nowadays I find dealing with Docker / Kubernetes and Linux system administration compelling. @youtube: https://www.youtube.com/channel/UC69XQPDbEpfAtO5S2-ZyNoA at udemy: https://www.udemy.com/user/nevyan-neykov/ Have a nice day !

View Full Profile →