Skip to content

certik/record

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Record
------

The record.py script uses gtk's "get_from_drawable()" function to take
screenshots and modified alsa's arecord to record the sound.

More details how it works:

The arecord and aplay alsa utilities are actually one and the same program, so
it was stripped down, all signals removed, all playback removed, all header
files merged into it, then a "capture_stop" global variable was added, which if
set to 1, the main audio capture loop will end. Then it is called from cython
using nogil in it's own thread and when the user wants to end it, the
"capture_stop" is set to 1. The main python thread takes screenshots in
periodic intervals (15 fps by default) and if it's late, it skips the frame, so
that the next one is on time. All screenshots are saved to the "data" file in
the temporary directory, which is later read and converted to a set of png
images. The audio is saved to a wav file.

It is then your job to create a video from it (and to convert sound to any
format you like, like ogg vorbis), it tells you some suggestions (see below).
Also the amplifier.py script is provided to amplify volume of the wav file in
case it is too quiet.

Usage
-----

Install the following packages in Debian/Ubuntu:

sudo apt-get install python-gtk2 libasound2-dev

and run it:

./record.py

It produces a wav file in the tmp directory (it tells you which) and a set of
png images. It also suggests you exact commands how to create videos from it,
using either mencoder or ffmpeg2theora (it's up to you).

In my experience mencoder can't sync the sound and video correctly, while
ffmpeg2theora just works. If the sound is too quiet, use the amplifier.py
utility to amplify the wav file before converting it to ogg or the
"normalize-audio" program (better results) from the Debian package of the same
name (it operates *inplace* on the wav file).

Convert to FLV
--------------

In order to convert to FLV, so that you can play it with flowplayer (flash
player in the browser), use the script theora2flv.

License
-------

The arecord.c file is GPL (see alsa-utils for more info), all the other code is
BSD. The package as a whole is GPL due to arecord.c.

Flowplayer
----------

Example of usage:

<a href="level-set.flv"
    style="display:block;width:500px;height:399px" id="player1"> </a>
<script src="http://femhub.googlecode.com/svn/trunk/swf/flowplayer-3.1.1.min.js"
    type="text/javascript"> </script>
<script type="text/javascript">
    flowplayer("player1",
            "http://femhub.googlecode.com/svn/trunk/swf/flowplayer-3.1.1.swf",
            {
playlist: [
{ url: "lset4.png", autoPlay: true},
{ url: "level-set.flv", autoPlay: false}
]
            });
</script>