Advertisement

You're blocking ads, which pay for BlenderNation. Read about other ways to support us.

Screen Capture With Python

23

Want to record your screen to make a video tutorial or show off some realtime artwork? If you're on linux there aren't many good screen recording utilities, and those that there are may not record to a video codec of your liking. FFFMPEG offers a plethora of command line options, but if you're not adept at using the terminal you may want something simpler. Thankfully Nathan Vegdahl has created a great script to simplify screen capture with python, and David Revoy subsequently wrote a nice tutorial on how to use it.

Screencapture.py script and tutorial

23 Comments

  1. I told Bart about this method a very long time ago, but being his usual racist, retarded and religious self, he refused to tell Blender users about it.

  2. being a noob (to say the least) to using python does anyone here have the time to show the basics on starting this script? i've been scratching my head for a few hours now with 'tutors' on using python, but all i really want to do is run this script. thanks.

  3. @oneshotal: Assuming you're running Linux, you open a terminal window. In the terminal, you type "git clone git://git.cessen.com/recordscreen.git" without the quotes and hit Enter.
    After a few seconds the file will have been downloaded.
    Next, you type "cd recordscreen" without the quotes and hit Enter.
    Then you type "./recordscreen.py" without the quotes and hit Enter.
    At that time, the script will start your recording session.
    When you're done, go back to the terminal screen and hit the "q" key.
    At that point, your recording should be saved with the file name(s) "out_0001.mkv", "out_0002.mkv" aso. in the same directory.

    Hope this helps! If you're using Windows, or (God forbid!) Mac, the instructions will be roughly the same, I guess, but maybe someone else can elaborate on that.

  4. This is a very interesting development considering that gui-based screencapturing linux tools such as gtkrecordmydesktop really lag behind these days -unlike say a couple of years ago. Thus, the only option is to use the command line which for most linux folks is no big deal. What *is* a big deal, though, is to figure out the proper screen capture settings using ffmpeg. I have found that what is an even *bigger* deal is to edit/post process the screencasts produced.

    For example, the container used in the script is matroska and, in principle, there is nothing wrong with that.
    However, if one imports the screen captured videos into VSE for editing problems arise. In my case even though ffmpeg captured 25 fps and everything seemed fine in the VSE (i.e. there was proper audio/video sync and the length of the video/audio strips matched perfectly), rendering the video out led to a mismatch because the actual fps was 50 instead of 25! The fps ffmpeg uses is not the same that is maintained in the matroska container! As Blender uses ffmpeg to decode the video, this means that although playback is fine rendering out leads to loss of audio and video sync (i.e. the video goes 2x and at about the middle you only get black frames)! :(
    This was a recent painful realization as I spent a couple of days editing screencasts before I realized that I couldn't render them. I haven't tested any other video editors though so maybe this is a problem only if one uses Blender's VSE.
    Btw, the solution is to convert losselessly mkv to an mp4 container which can then be imported into VSE for editing. Everything worked fine after that.

Leave A Reply

To add a profile picture to your message, register your email address with Gravatar.com. To protect your email address, create an account on BlenderNation and log in when posting a message.

Advertisement

×