Want to make a screencast on Linux but feeling overwhelmed by the choice of tools and programs? We describe three ways to create a screencast. The quick and easy way, the hard-core and granular way, and the way we think is the best all-rounder.
How to Film a Good Screencast
To create a screencast, you have to record what’s happening on your desktop, together with the commentary you’re adding to it. That requires the ability to record video from your desktop, and audio from your Linux sound subsystem, and possibly from other sources as well.
When you watch a good screencast, you’ll notice the commentary or narrative is right on point. It’s polished. The delivery has confidence and clarity. There’s no room for “um’s and ah’s” when you are producing a screencast. They’re painful to listen to, and they make your screencast feel amateurish. That’s the very opposite of the effect you’re trying to create. You want your audience to feel that you are an authority on whatever it is you’re talking about. Sounding like you’re bumbling your way through isn’t the way to do that.
Because of this, many of the slicker screencasts have their audio track recorded and edited separately and then mixed back into the screen video. That’s too big a topic to cover in one small article, so we’re going to look at ways to record the audio and the desktop video at the same time. That doesn’t mean you’re doomed to sounding amateurish. There are simple techniques you can use to raise the quality of your verbal delivery.
The most elementary—but the most impactful—are a script and practice. Run through your screencast several times before you try to record it. Take notes so that you know what you want to say, and which points you want to draw particular attention to. Don’t be put off by the word “script.” It doesn’t need to be a sophisticated document. A page or two of easy to read bullet points will help enormously. Paradoxically, you don’t want to be distracted trying to read the script when you’re supposed to be speaking.
Put the time in with dry-runs. There’s a reason professionals have rehearsals. It is very difficult to step through the topic you want to describe, control the software you’re using to screencast, and still deliver a good verbal performance.
Pick a Good Microphone (and Camera, If You Want)
You’re going to need something to record your voice. That means buying a microphone if you don’t already own one. It’d be a small miracle if the one built into your laptop is going to be good enough. It doesn’t have to cost a fortune, but a reasonable, external microphone that allows you to talk naturally and be recorded at a good volume is an absolute must-have. And a stand for it will pay dividends.
If you want to film yourself so that you appear in your screencast, you’re going to need a camera. If all it is going to record is your head and shoulders so that you can be seen in a small window in one corner of your screencast, you don’t need a movie grade camera. But you’ll need something a step up from the basic built-in webcam that came with your laptop. A separate camera means you can place it where you need it to be.
Auto-focus, automatic light adjustment, and a good resolution sensor are all important factors. It’s not out of the question that a good grade camera may have a microphone sufficient to your needs. So if you’re in the market for a camera and a microphone, get the camera first and see if the microphone is up to the task.
Short, SIlent Clips: Use GNOME’s Built-In Recorder
It’s worth mentioning in passing that if you use the GNOME desktop environment (DE), you have access to a simple screen recorder built right into your DE—but without any audio. If you have a need for a short, silent, video clip, this will suffice. For example, it would be perfect to create a small clip to send to someone to show them the steps required to reproduce a bug.
To start recording the activity on your desktop, simply press:
Screen recording will start immediately. A red circular indicator will appear in the tool notification area, close to the networking, sound, and power icons.
To stop the recording, use the same key combination:
The recording indicator is removed from the notification area. Your recording is stored in your
~/Videos directory with a timestamped filename. The file will have a “.webm” extension, indicating it has been recorded in the WebM video format.
Note that by default, the maximum recording length is 30 seconds. You can adjust that using the dconf-editor. The setting is located under
org > gnome > settings-daemon > plugins > media-keys. The setting to adjust is called
Quick and Easy: Record With recordMyDesktop
recordMydesktop is a simple and straightforward screen and audio recording tool. It allows you to record your desktop, a section of the desktop, or a specific application window.
To install recordMyDesktop on Ubuntu, use this command:
sudo apt-get install recordmydesktop gtk-recordmydesktop
To install recordMyDesktop on Fedora, use this command:
sudo dnf install recordmydesktop gtk-recordmydesktop
To install recordMyDesktop on Manjaro, use this command:
sudo pacman -Syrecordmydesktop gtk-recordmydesktop
The user interface is very simple.
By default, recordMyDesktop will record the entire desktop. To record a portion of the desktop, left-click and drag in the preview thumbnail. This will define a portion of the screen that will be used for recording. To record a single application window, click the “Select window” button, then click on the application window on your desktop.
When you are ready to record, click the “Record” button. A red indicator will appear in the notification area close to the networking, sound, and power icons.
Left-click on the indicator and select “Stop” from the menu to stop recording. The recording is processed by recordMyDesktop so that it can be saved. If you cancel this process, you’ll lose your recording.
When the recording has been processed, click the “Save as” button to save your screencast. A “File Save” dialog allows you to choose where to save the recording.
The recording is in the “.ogv” Ogg video format. It is the only format provided. To convert the file to a different video format, you could use the next tool we’ll discuss, which is
From the Command Line: ffmpeg
The FFmpeg project released its first version of the
ffmpeg utility in the year 2000. Their original vision for a useful graphics and video conversion program has been far surpassed.
ffmpeg is now a tremendously capable suite of tools and codecs, and is used in numerous other well-known applications such as VLC, Plex, and Blender.
If you ever need to do some audio or video recording or format conversion, and you’re wondering whether
ffmpeg can do it, you can stop wondering. Basically, the answer is “yes.”
ffmpeg has many, many options. Here’s a list of
ffmpeg options that runs to over 4000 lines. That wealth of rich functionality does pose quite a learning curve if you want to do anything beyond simple format conversions. There’s no pretty front end for
ffmpeg , but what it lacks in terms of interface it makes up for in sheer power, speed, and flexibility. And because it is command-line driven, you can call it from scripts. You can record transient output from unattended commands or record GUI screen activity that can’t be redirected into a file.
During our testing,
ffmpeg had to be installed on Fedora 31 and Ubuntu 18.04. It was already present on Manjaro 18.1.0. To install
ffmpeg on Ubuntu, use this command:
sudo apt-get install ffmpeg
To install it on Fedora required the addition of two repositories. This command will register the first:
sudo dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
This command will register the second:
sudo dnf -y install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
ffmpeg application can now be installed with this command:
sudo dnf -y install ffmpeg
How to Record Video and Audio with ffmpeg
To keep things (relatively) simple, we’ll do a straight-forward recording of the entire desktop with audio. There are quite a few parameters we must provide to
ffmpeg to get this done. We can use some utilities to help us find the values for some of them.
To identify the available screen resolutions, we can use
xrandr. We don’t need to provide any parameters to this command:
The output lists all of the available screen resolutions.
The current resolution—and highest available on this test machine—is 1920×1080. We’ll use that.
Now we’ll find out which PulseAudio sound sources exist on this test machine. We’ll use the
pactl utility and ask it to list the sources. The syntax is refreshingly simple:
pactl list sources
By scrolling through the detailed output, we can see that there is a
source #0, which is an output source. That means it produces sound output.
Checking the rest of the output reveals another source called
source #1. This is an input source.
That means source #1 accepts sound input. This would come from a microphone, for example. So we’ll use source #1 with
ffmpeg and record our voice via the microphone.
Here’s the entire
ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i 1 output.mkv -async 1 -vsync 1
Let’s break that down:
- -video_size 1920×1080: Sets the size of the video capture. This is the value we used
- -framerate 25: Sets the frames per second value.
- -f x11grab: Force the video format to a specific type. Here we’re setting the input format to the output of your X server.
- -i :0.0: This specifies the video input will come from the main screen.
- -f pulse: Sets the expected format to be PulseAudio.
- -ac 2: Set two audio channels
- -i 1: Take audio input from PulseAudio source #1. This is the value we used
- output.mkv: The name of the file we wish to create.
- -async 1: Set the audio sync method. This is a deprecated parameter, but we’re using it here to avoid error messages that can be ignored.
- -vsync 1: set the video sync method. This is a deprecated parameter, but we’re using it here to avoid error messages that can be ignored.
You can see a lot of information scrolling in the terminal window as the recording takes place. Minimize this terminal window or put the main window of the application you’re talking about on top of it so that it doesn’t appear in your screencast.
To stop the recording, enter Ctrl+C in the terminal window. If all goes well, you’ll see a confirmation message from
ffmpeg reporting that it is exiting normally.
We didn’t put a path on the output filename in the
ffmpeg command, so it’ll be created in the directory
ffmpeg was launched from. In this example, that was our home directory.
Converting Video Files with ffmpeg
We noted earlier that the preferred video format for upload to YouTube is MPEG-4. We can easily convert the “.mkv” to a “.mp4” file using
ffmpeg. We say “convert,” but actually, we’re creating a new file altogether. Your original file is untouched.
The command is simple. We tell
ffmpeg to use the original file as the input, using the
-i (input) option. The file extension of the output file tells
ffmpeg what type of file to create.
ffmpeg -i output,mkv output.mp4
A new file is created with an “.mp4” file extension.
To convert our screencast that was recorded with the
Ctrl+Shift+Alt+R method to the MPEG-4 video format, use this command:
ffmpwg -i "Screencast from 11-02-19 10:47:05.webm" output.mp4
Capable But User-Friendly: Use OBS Studio
If you’re looking for something that has more capabilities than recordMyDesktop and is easier to drive than
ffmpeg, Open Broadcaster Software Studio (OBS Studio) ticks all the boxes.
Install OBS Studio on Ubuntu with this command:
sudo apt-get install obs-studio
Install OBS Studio on Fedora with this command:
sudo dnf install obs-studio
Install OBS Studio on Manjaro with this command:
sudo pacman -Sy obs-studio
How to Use Sources and Scenes in OBS Studio
OBS Studio has a large work area and a collection of panes along the bottom of the application.
Where do you start?
To put the software through its paces, I needed a target, some end-point that I could try to achieve. It seemed sensible to watch a good screencast and then try to replicate their production. The screencast I used as a template showed a desktop with several open applications on it. There was a small inset window showing a view of the presenter. Occasionally, the display was changed to show a zoomed-in view of a single window. This allowed a particular detail to be discussed. A voiceover provided the narrative.
All of that was surprisingly easy to replicate in OBS Studio, because of its concept of scenes and sources. A source in OBS is something that produces sound or video. Your desktop, a window on the desktop, a webcam, an output audio source, and an input audio source such as a microphone are all valid sources.
A collection of sources can be combined into a scene. Multiple scenes can be created containing different combinations of sources. Hopping between scenes is accomplished with a single mouse click.
To create a scene, right-click in the “Scenes” pane and click on “Add” in the context menu. Enter a name for the scene in the “Add Scene” dialog and click the “OK” button.
The scenes you create are listed in the “Scenes” pane.
We have created two scenes, one for the desktop and webcam composite view, and one for the zoomed-in view of the terminal window. We need to add some sources to these scenes. We’ll use the “Zoom on Terminal Window” scene. To add sources to a scene, select it in the “Scenes” pane then right-click in the “Sources” pane. Click on “Add” in the context menu.
The menu allows you to add images, audio inputs and outputs, application windows, video sources, and other elements you may wish to include in the screencast. We’re going to capture a window. Click on the “Window Capture (Xcomposite)” menu option.
In the “Create/Select Source” dialog, create a name for the source and click the “OK” button.
In the “Properties for Window Capture” dialog, use the “Window” drop-down menu to select the window you wish to add to the scene and click the “OK” button.
Let’s repeat that and add a source for the microphone. Right-click in the “Sources” pane and click on “Add” in the context menu. The test machine used to research this article used PulseAudio. If you were using a different scheme such as Advanced Linux Sound Architecture (ALSA), you’d select different options. We chose “Audio Input Capture (PulseAudio)” from the menu.
In the “Create/Select Source” dialog, give a name to the source and click the “OK” button.
In the “Properties for ‘Audio Input Capture (Pulse Audio)’” dialog, use the “Device” drop-down to pick the sound device your microphone is connected to. Click the “OK” button.
Your “Sources” pane should now have two sources in it, for the current scene.
There’s a lot of fine-tuning you can apply to your sources. For example, in the “Audio Mixer” pane, right-clicking on the settings icon for the microphone brings up a context menu.
Selecting “Filters” displays the “Filters for ‘Microphone’” dialog.
To add a filter, right-click in the left-hand pane and select “Add” from the context menu. Each filter has properties that can be adjusted.
By trial and error, we settled on a selection of filters and settings that worked well with the test microphone. We achieved a good balance between clarity and volume and a reduction in background noise.
Creating a second scene was just as easy. The desktop we were recording was running in a virtual machine. That was easily added to its scene by adding in the window that the entire virtual machine was running in. The webcam was added as a video source and dragged and sized to sit in the corner of the display. Here’s the view the audience would receive:
Moving between the two scenes is as simple as clicking on the scene name in the “Scenes” pane. The zoomed-in terminal scene gave a full-screen view of the Top command in a terminal window.
If you need to deliver your screencast in a different video format, OBS Studio can do the conversions for you or, of course, you could use
Lights, Camera, Action
You might never make it to Hollywood, but if you need to deliver a well-produced screencast, Linux has all the tools you need.