Recordscreen.py : video and audio capture

Published on

Update 2018:
This article is obviously obsolete now we have OBS and SimpleScreenRecorder on GNU/Linux. I invite you to directly give them a try if you are looking for a solution to record your desktop and accidentally found this archive of my blog and this solution that was working in 2012...


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.

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



License: "Recordscreen.py : video and audio capture" by David Revoy − CC-BY 4.0
Tags:  #linux  #install   | Download: Markdown
25 comments

25 comments

link deburger  

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

link David Revoy Author,

@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 !

link deburger  

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

link David Revoy Author,

@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 !

link André  

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

link André  

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

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

link Silvio Grosso  

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 :-)

link David Revoy Author,

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

link Saverio  

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 :(

link David Revoy Author,

@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.

link Serban Stanescu  

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.

link David Revoy Author,

@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'. :)

link Peter James  

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!

link David Revoy Author,

@Peter James : Hey thanks for the feedback !

link Luis Miguel Delgado  

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.

link Leonardo  

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)

link dharani  

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

link David Revoy Author,

@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.

link per funke  

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!

link pwe funke  

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

link Zineb  

Hi, does this record videos too ?

link Barry  

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!!!

link The_NetZ  

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

link Camilla De Sira  

Way cool! I appreciate this method plus the rest of the website, extremely good.

link Inez  

Hurrah, that's what I was looking for!


Post a reply

The comments on this article are archived and unfortunately not yet connected to a dedicated post on Mastodon. Feel free to continue the discussion on the social media of your choice. Link to this post:

You can also quote my account so I'll get a notification.
(eg. @davidrevoy@framapiaf.org on my Mastodon profile.)