To create a screencast using Linux command line tools I have used the methods outlined on this page:
https://sandilands.info/sgordon/multimedia-on-linux-command-line
(Ctrl-F screencast)
This might not be the easiest method, but it was simple enough for me and uses only tools that I had installed already.
There are two scripts:
- https://sandilands.info/sgordon/doc/code/screencast captures sound from mic and video from screen, produces 2 files; and
- https://sandilands.info/sgordon/doc/code/audioscreen2video combines audio and video into one video file
You will have to make sure that the packages sox
and ffmpeg
are installed,
using your package manager.
I copied and pasted these script into files ~/bin/screencast
and
~/bin/audioscreen2video
and made them executable by chmod 755 ~/bin/screencast
and chmod 755 ~/bin/audioscreen2video
.
You will have to modify the screencast
script to set your screen
resolution correctly, as follows. After the line starting # Set the screen size ...
the author has included various resolution settings for his own
setup, such as lenovo
, home
, lecture
, etc, by checking the first input
argument of the script using various if/elif
blocks. The default setting is
in the last else
block screenSize=800x600
. I changed this to my own screen
resolution, i.e. screenSize=2560x1440
, and give the script a computer name it
doens't know as its first argument, e.g. stefan
. You can find out your screen
resolution with the xrandr
command, cf. https://askubuntu.com/a/584692.
To bring the filesize down a little, I also changed the line starting with screenOptions
to
screenOptions=" -preset ultrafast "
After doing this, start recording a screencast by
~/bin/screencast stefan /tmp/MTH3028
There is a 5 seconds delay before recording starts. To end the recording you
hit z
(in the terminal window where the screencast
script is running).
This should create two files /tmp/MTH3028-audio.flac
and
/tmp/MTH3028-screen.mp4
.
To combine the files into a single video file, use the audioscreen2video
script:
~/bin/audioscreen2video /tmp/MTH3028 2020-03-16
The first argument is the same as the second argument given to screencast
.
The resulting file is called /tmp/MTH3028-video-2020-03-16.mp4
.