Follow me for updates and bonus :

illustrator , concept-artist

Recordscreen.py : video and audio capture from terminal for Ubuntu 12.04

11 september 2012

recordscreen splash

Recordscreen.py is a script to do screen record and video on Linux , developed in 2011 by Nathan Vegdahl my friend and colleague from the project Sintel .  With this script , screen-capture from command line is easier via ffmpeg/libAv with a Python script.  I update here the old blog post,  to maintain the script for the LTS version of Ubuntu and it switch to AVconv. 

If you look for a simple screen recording solution with a GUI, try Kazam from the software center or :
sudo apt-get install kazam
( thanks Deburger for the tip in the comments )


Ubuntu Linux 12.04 and Ubuntu based distribution :

Install those libraries ( inside a terminal ) :
sudo apt-get install wget libav-tools ffmpeg libavc1394-0 libavformat-extra-53 libavfilter2 libavutil-extra-51 mencoder libavahi-common-data
Then still in the terminal , do this line after line , to install the script :   
wget http://www.davidrevoy.com/data/documents/recordscreen_12-04.zip
unzip recordscreen_12-04.zip
rm recordscreen_12-04.zip
chmod +x recordscreen.py
( or install it manually from this link :  recordscreen_12-04.zip  )

Usage :

If you want to screencapture go with a terminal where the script is and type :
./recordscreen.py

The terminal windows will start recording, and gives you feedback on the frame recorded.
Reduce the terminal windows, and start recording your demo.
To stop the process, call back the terminal windows and press 'Ctrl+C' twice on the keyboard over it.
Your video file will be saved next to your recordscreen.py file.
You can play it using VLC player.

For more informations, the script has a nice --help page ; with many flags to customise your settings ( width / high / ratio / framerate / audio / etc .... )  . Don't hesitate to read the documention  :

./recordscreen.py --help

Note about file compression :

I use here the default setting. The raw videos are very large but recording is smooth. Before working on them on my favorite open-source video editor Kdenlive  , I compress my source video with Avconv , in a terminal, like this :

avconv -i input.mkv -vcodec libx264 -r 30 -pre libx264-slower -an -threads 0 output.mkv

Then I can delete my sources , and keep my new compressed sources.
( ex : old file = 50MB , newer compressed file = 2.5MB )

For developpers :

Nathan's sources version from the GIT sources :

git clone git://git.cessen.com/recordscreen.git


Illustration credit on the visual : microphone and camera icons of the Faenza icon set

Share this page :

^

23 comments

Avatar Gravatar

deburgerwall.pp.ua
tuesday 11 september 2012, 19:46

why don't you use «kazam» or something like that?

http://www.davidrevoy.com/
tuesday 11 september 2012, 20:08

@deburger : I tested the past years all the GUI ones ( as gtk-recordmydesktop, istambul and other Kazam included ) . But when I tested, most of them were not working, or outputing corrupted video files. It happens during key production moment of my DVDs, or video tutorials. So, I end up to trust only on this script.

So I ignored Kazam, but I just tested it. It's perfect, and it worked like a charm. I'm impressed. I will update the article. Thanks for pointing it this tool !

Avatar Gravatar

deburgerwall.pp.ua
wednesday 12 september 2012, 00:19

so, can we wait for speedpaint screencasts from you ;) ?

http://www.davidrevoy.com/
wednesday 12 september 2012, 01:20

@deburger : Well guessed ;)
I just finished test with Kazam *.webm output and loading them in Kdenlive, and this is not laggy to video edit, and webm are really well compressed on disk. All of this makes my screencapture life 10 time easier. thanks again !

Avatar Gravatar

5. André


wednesday 12 september 2012, 16:33

Here is the launchpad-site of kazam:
https://launchpad.net/kazam

There is a PPA for unstable builds (actual 1.3.0):
https://launchpad.net/~kazam-team/+archive/unstable-series

Avatar Gravatar

6. André


wednesday 12 september 2012, 16:35

PS.: Forget to add the blog with the development-news:

http://www.twm-kd.com/category/linux/kazam/

Avatar Gravatar

7. Silvio Grosso


sunday 16 september 2012, 19:31

Hi everyone,

As regards Kazam, I agree it is VERY useful and promising :-)

Lately, on Ubuntu 12.04 (Unity Desktop), I have been trying Eidete as well:
https://launchpad.net/eidete

Here is a short video demo on YouTube:
http://www.youtube.com/watch?v=MUmwAjNL2xc&feature=related

In my view, Eidete is more powerful than Kazam BUT it is a bit more unstable as well.
As a consequence, I ended up using mostly Kazam.

For anyone working on KDE there is FDesktopRecorder too (which I have personally never tried):
http://opendesktop.org/content/show.php?content=147844
This one looks interesting too :-)

http://www.davidrevoy.com/
sunday 16 september 2012, 20:13

@Silvio Grosso : Hi Silvio, thanks for the answer and for the precious information and links. It will help for sure !

Avatar Gravatar

9. Saverio


thursday 29 november 2012, 12:25

Hello David,

sorry if I disturb but I have a question about kazam on kde linux ditros (like kubuntu)... is it working for you? After I have installed it on my kubuntu amd64 and try to launch it, kazam doesn not launch :(

http://www.davidrevoy.com/
thursday 29 november 2012, 12:52

@Saverio : Hi Saverio, yes, here Kazam works on the Kubuntu 12.04 with last updates. i didn't upgraded to the unstable 12.10 because, well, it's unstable.

Avatar Gravatar

http://www.sserbanro.com
wednesday 12 december 2012, 11:43

Hi, everybody!
I used Kazam on Linux Mint 13. Video output is great but the audio captured through Lexicon Lambda through a dynamic mic, is mono and on one channel. Probably it cas be fixed through some audio settings. Otherwise, the recording is usable with OpenShot (v 1.4.1).
As for RecordMyDesktop, it seems that video files that are ranging from 2 to 7 minutes, convert OK with mencoder, and it takes some 300 - 500 seconds only, opposite to converting with avconv (very poor video result and huge sound desyncs).
I think I will write an article on this subject since I am interested in video tutorials and I'd be glad to get some more info about workarounds.

http://www.davidrevoy.com/
wednesday 12 december 2012, 12:42

@Serban Stanescu : Hey thanks for your feedbacks, and don't hesitate to put a link if you write something about. On Linux ; video library / graphic server and video tools change a lot, and from one update to another it break easily. So it's still good to have an idea of 'whats working now'. :)

Avatar Gravatar

13. Peter James


saturday 19 january 2013, 13:25

Thank you so much for the tips!
This is some awesome screen capturing with ffmpeg

Now I found an even better frontend I think:

How I did it:
I used Checkinstall https://help.ubuntu.com/community/CheckInstall
to install this ffmpeg front end:

QFFCap
http://zaps166.sourceforge.net/?app=QFFCap
download link is under the screen shot

It basically does the ffmpeg commands for you and the default settings is some awesome quality.

Just hook it to your usr/bin ffmpeg executable in the top left settings.

Make a folder to store the file and direct it to that path with like .../Desktop/video.mkv

The file will be huge, but you can compress it later and the quality is awesome.
I was blown away with the result.

You should really try it.
Runs great on Ultimate Edition-3.4

I have tried all other front ends, but this one really beats everything.
and thank you again for leading me down that ffmpeg road!

http://www.davidrevoy.com/
saturday 19 january 2013, 19:12

@Peter James : Hey thanks for the feedback !

Avatar Gravatar

http://tunegocioenlanube.net
friday 25 january 2013, 10:37

Hi,

This is a great script. And i can lear python with this script. Thanks.

I try, Istanbul, RecordMyDesktop, KAZAM and Eidete, and all have problems. This script is perfetc. Thanks agains.

Best regards.

Avatar Gravatar

http://leojava.altervista.org
thursday 07 february 2013, 20:04

If you want you can also use vlc :)
just File->open (advanced) -> net ->url: "screen://" without quotes to screencast
OR
File->convert/save -> net -> url: "screen://" -> convert -> <your dest file> -> start -> stop (when you finish)

Avatar Gravatar

17. dharani


saturday 23 march 2013, 18:25

hi david nice script i could record my screen and my voice, but i could not record my training sessions audio on skype.
hi i would like to record the audio from the output ie speakers. i tried with options "-a hw:0 , hw:1, hw:0,1 and 1,0 and 1,1 but always i get this error "[alsa @ 0x94c0920] cannot open audio device hw:0 (Device or resource busy) hw:0: Input/output error"
can you please help me out

http://www.davidrevoy.com/
saturday 23 march 2013, 23:55

@dharani : Hey, thx. I also wanted to perform a 'record from the speaker' thing 2 month ago, and I spent a nightmare afternoon of hacking on it ; to stop at the end recording with the microphone of my webcam the speaker output ( I just wanted to grab the speech of someone on a streaming video xD ) . So, I have no idea how to perform it.
:-/ good luck if you dive on it.

Avatar Gravatar

19. per funke


monday 27 may 2013, 20:03

sorry to say: for me Kazam = misery = terrible application as for now. It will maybe mature into something I'd like to use but for now I prefer your script. It's by no means perfect BUT IT WORKS.
This isn't the first time the script works but not the nice app. I tried to index my 300000 art files w picasa. It hung. I wrote a script, a thousand times smaller. It wasn't perfect but it worked!
Thanks!

Avatar Gravatar

20. pwe funke


monday 27 may 2013, 20:12

"Delgado" really has a point here: I can learn python by reading this script. What can you learn from Kazam and friends?

Avatar Gravatar

21. Zineb


saturday 24 august 2013, 16:34

Hi, does this record videos too ?

Avatar Gravatar

22. Barry


wednesday 11 september 2013, 19:53

Just adding a quick update for everyone's benefit... I've been searching for quite some time for something that would do the trick recording the beautiful GOOM visualization in the Totem player (see the display tab in the preferences dialog) and I found it to be a nightmare working with most of the Linux desktop recording tools that are out there. All that I tried either failed for one reason or another--they couldn't record the audio, couldn't record without losing frames, configuration was too hard--whatever. Then today, I happened onto "SimpleScreenRecorder" (http://www.maartenbaert.be/simplescreenrecorder/). I'm telling you, it worked flawlessly. It even picks good defaults for you depending on the setting you've chosen... And BTW, don't let the name fool you--it has more options than most other packages out there... I'm running on Mint 15/Mate (the liveCD) and the only other thing I had to install was libavcodec-extra-53. Bravo Maarten Baert!!!

Avatar Gravatar

23. The_NetZ


wednesday 18 december 2013, 05:11

Many thanks, I use this script to record all my youtube shows :P

Rss feed of the article's comments

Write a Comment

What is the second letter of the word eukh? :