Zoom.Quiet@gmail.com | My favorites | Profile | Sign out
Project Logo
Updated Feb 19, 2009 by michael.ogawa
Howto generate a video of your project's activity with code_swarm.


There are several ways to generate a video:

A dialog will show up, asking you for the repository url, your username and password. The repository gets fetched, converted and codeswarm will be started. This will create the frames of the video for you. If you want to create a real video, see "Creating the video" (below).

This guide explains how to generate a video under a Linux install (it is based on Linux tools) but might be applied to a Windows workstation as well (some other tools might need to be used)

To make it short, generating your video is done in 4 steps :

  1. get the activity log out of your versionning system
  2. convert the activity log to something code_swarm can use
  3. excuting code_swarm
  4. making a video out of the exported images

The first step, of course, is to download code_swarm from SVN (check out the Source Checkout page for that). You will also need java and ant to build it.

Getting the activity log


To get the activity log from your SVN repository, just get a local copy of your repository, enter the main directory and execute

  svn log -v > activity.log

This will create a file called activity.log.


To get the activity log from your CVS repository, just get a local copy of your repository, enter the main directory and execute

  cvs log > activity.log

This will create a file called activity.log.

MediaWiki (Using SwarmExport extension)

To get a wikiswarm report from the wiki use the maintenance script inside of the SwarmExport extension: http://svn.nadir-point.com/viewvc/mediawiki-extensions/branches/stable/SwarmExport/


  darcs changes --summary --reverse > activity.log

Other versionning systems

Documentation to come

Convert the log

code_swarm has a python converter in its convert_logs directory. Before you start using it, make sure you read this issue report: http://code.google.com/p/codeswarm/issues/detail?id=6

  1. Move to the convert_logs directory
  2. Copy the activity.log file generated above into the current directory
  3. Launch the convert_logs.py script:
    • For SVN use: python convert_logs.py -s activity.log -o activity.xml
    • For CVS use: python convert_logs.py -c activity.log -o activity.xml
    • For MediaWiki using SwarmExport use: python convert_logs.py --wikiswarm-log=activity.log -o activity.xml
    • For a list of other available systems, use: python convert_logs.py --help

This will generate a file called activity.xml.

At this point, you will not need activity.log anymore, so you can delete it.

Executing code_swarm

To execute code_swarm, you need just need ant and javac. For most people, you just want to check out trunk and use the supplied ant script or run.sh script in that directory. Please refer to the [HowtoBuild] Wiki page.

Before running, you will need to configure a config file for your project. /trunk/data has an example of a config file. See the rest of the wiki for more help.

Creating the video

The previous step created a series of screenshots in the PNG format under the code_swarm/frames/ directory. Now you want to use them to build a video. MEncoder is one tool to do that. Just get into that frames/ directory and type:

  mencoder mf://*.png -mf fps=24:type=png -ovc lavc -oac copy -o movie.avi

For a 15000 commits video, this might take about 40MB, so you want to reduce the size a little bit. You can do that by converting to DivX (MPG4) and reducing the frame rate:

  mencoder movie.avi  -ovc xvid -oac mp3lame -xvidencopts bitrate=200 -o project-activity.avi

For a 40MB video, this reduces the size to 10MB. You can also try using the h264 format if your MEncoder has the right libraries to do so:

  mencoder movie.avi -ovc x264 -oac mp3lame -xvidencopts bitrate=200 -o project-activity2.avi

To make a high quality .mov (no loss from the frames) suitable for iMovie or Final Cut:

  ffmpeg -f image2 -r 24 -i ./frames/swarm-%05d.png -sameq ./out.mov -pass 2 

(Or you can use Quick Time Player to open a image sequence and then save a resulting high quality .mov file.)

That's it, you should have a beautiful video of your project's activity by now!

Comment by BVandeputte, Jun 25, 2008

please add a line (for noobs like me) to say what python version is required (2.5?) to convert logs ;)

Comment by hestomet, Jun 25, 2008

You can also use ffmpeg for generating the video (from your frames directory): ffmpeg -f image2 -i swarm-%05d.png /tmp/foobar.mpg

Comment by BVandeputte, Jun 25, 2008

maybe plan a option to convert apache/httpd access log into xml event would be a good idea ?

Comment by goa...@mail.ru, Jun 25, 2008

"To execute code_swarm, you need the Processing application (which uses Java)." I'm newbie, so can you please explain me what exactly I have to type in my command line to execute code_swarm (I use Ubuntu 8.04)?

Comment by altjeringa, Jun 25, 2008

"Processing" is an application you down load from


Comment by ve...@difane.com, Jun 26, 2008


mencoder mf://.png -mf fps=24:type=png -ovc lavc -oac copy -o movie.avi 

must be changed to

mencoder mf://*.png -mf fps=24:type=png -ovc lavc -oac copy -o movie.avi  

Regards, Vyacheslav

Comment by hans.forsberg, Jun 26, 2008

Wher do I store activity.xml, I am using version 0.139, and it seems to execute but nothing happens. I have put activity.xml in the data folder, should it be somwhere else?

Comment by daniel.watling, Jun 26, 2008

Just an FYI, if you are trying to generate an activity.xml for CVS (it's on this project's trunk as of this morning), you will need to do the following: 1) Line 142 should be "...strip()", not "...strip('\n')". I had some issues where there was still a carriage-return at the end of the line which caused it not to equate properly. 2) After your output, you WILL need to sort it. In order to do this, you can change line 182 (where the "xml_handle" writes out the event) to write the date out first. Once you've done this, run the converter. Edit the XML output, and remove the first two lines and the very last line. Run sort on it, then add the three lines back in. Now you're ready to go. If anyone has alternatives to make this easier, let me know!

Comment by daniel.watling, Jun 26, 2008

Actually, you will need to write out the date, then author, then filename for 'sort' to work correctly.

Comment by valery1707, Jun 27, 2008

What command necessary use with CVS Reposotory for generate correct log file?

Comment by daniel.watling, Jun 27, 2008

I can only speak for Ubuntu 8.04 (although I wouldn't be surprised if this applies to all nix systems). After you've got the activity.xml for CVS and you've removed the appropriate lines do something like the following:

sort activity.xml > sorted-activity.xml

Comment by jeremywosborne, Jun 28, 2008

Here's my java n00b question: Is this geared to a specific JDK? I'm using JDK 1.6.0_10-beta-b25 and am getting stack traces using code_swarm.pde with Processing. Also, was this written with a certain version of Processing? (I'm going to see if I can answer my own question and user a previous version of Processing.) Thanks for any help. If I wasn't such a Java dork, I'd help out with this program.

Comment by jeremywosborne, Jun 28, 2008

There appears to be a limit, at least on my rinky system (only 1G RAM on Windows Vista), to the size allowed in the generically named activity.xml file. Had a 20 MB SVN dump from a very busy /trunk. Broke this down to ~5MB and everything works fine. I did (finally) read the FAQ. My processing version was too old (I grabbed the 0135 beta, not the newer 0142 beta) and figured out my jdk was just fine. Thanks guys/gals for the cool program.

Comment by arjenw, Jul 03, 2008

In order to process a lot of data it does require a lot of memory. Each file node that ever enters CVS/SVN is kept internally for book keeping, so it does add up.

I generally run at about 512m with large files, which seems good enough, but if you don't have that free the only way is to split up the file indeed.

Comment by ajbanck, Jul 03, 2008

I created a converter to generate the activity xml from Perforce. Let me know if there is interest in this and I can try to upload it somewhere.

Comment by acgourley, Jul 06, 2008

ajbanck - email it to me and i'll commit: acgourley (gmail)

Comment by michael.ogawa, Jul 09, 2008

For users of ffmpeg, here's the command I used: ffmpeg -f image2 -r 24 -i ./frames/swarm-%05d.png -sameq ./out.mov -pass 2

That means input as images, 24 frames per second, input filename format, high quality, output file, 2 passes.

Comment by ol.loginov, Jul 17, 2008

ajbanck: could you mail the converter to "oregu at yandex dot ru"?

Comment by halyava, Aug 04, 2008

convert_logs.py script now supports perforce: python convert_logs.py "--perforce-path=//depot/..." This command will generate depot.xml including all file activities in specified perforce folder. Command "p4" should be installed and configured.

Comment by harald.schilly, Aug 21, 2008

there is no sound, use the "-nosound" switch for mencoder and remove the -oac copy ...

Comment by arne_...@web.de, Aug 28, 2008

If you want to create movies from Mercurial repositories, you can use the code from Baptiste Lepilleur:


With it he created this beautiful Mercurial codeswarm video:


Comment by latestlinux, Sep 04, 2008

To answer some of the above questions:

To actually run this follow the instr. above and:

  1. on Winblows XP for example, move convert_logs\activity.xml to data\activity.xml
2) edit data\sample.config and change the following:
a) InputFile?=data\activity.xml b) TakeSnapshots?=true c) DrawNamesHalos?=true (looks a little nicer)
3) create directory "frames" in 4) type run.bat 5) accept the default location for data\sample.config 6) follow the mencoder directions (mencoder is better than ffmpeg in my opinion - more efficient and I trust mplayer more on the front-end)


Comment by arne_...@web.de, Sep 06, 2008

I just created a script which can pull in and combine commits from many different projects and creates codeswarms from only the changes since the last created codeswarm.

It isn't yet polished, but I think it might be quite useful.


I use it to gather commit data from many different repositories, but I plan to use it to track code evolution of bigger projects in near-realtime (means: checking once a day or so :) ).

It automatically creates a video, and names it shared_movie_DATE-TIME.avi

For using it, you need to write a "simple.config" file like the following: - http://freehg.org/u/ArneBab/shared_codeswarm/raw-file/tip/simple.config

Then put it into a directory and start the community_codeswarm.py script in that directory.

- python community_codeswarm.py --codeswarm-path "absolute path to the codeswarm dir"

For it to work, you need pyyaml, Mercurial and naturally codeswarm installed. - http://pyyaml.org/ - http://selenic.com/mercurial

Please tell me how the script works for you! - http://draketo.de/contact

License: GPLv3 - like codeswarm. - Arne Babenhauserheide

Comment by ammon.shepherd, Oct 28, 2008

For everyone's info:

I was able to get code_swarm running beautifully on an Intel MacBook? Pro running 10.5+. I had to use MacPorts? to install a number of applications, but it works just like the instructions for a GNU/Linux setup.

I would also like to request that the steps in Sebastian's comment (Sept 04, 2008) be put in the general instructions. I was lost without the tip to create the frames directory and update the data/sample.config. One could also edit the run.sh file and point the "default_config" variable to a different named file.

-Ammon Shepherd

Comment by cliffwiebe, Dec 01, 2008

ajbanck, i see you've worked with perforce. anyone else? if you have the way to create the perforce activity xml - can you tell us where it's posted or how to get it?


Comment by wiredbob, Dec 05, 2008

@latestlinux thanks, that got me started quickly

Comment by Nick.Porcino, Feb 11, 2009

Did the Perforce script get committed?

Comment by hamsterfight, Feb 11, 2009

recent mencoders need the following for h264 output:

mencoder mf://code_swarm-0.png -mf fps=25:type=png -ovc x264 -x264encopts bitrate=200 -o output.avi

Comment by klaus.from.hell, Mar 11, 2009

Hello @all, Generating den PNGs from SVN Activity was pretty easy.

Now i try to use mencoder for Windows to generate an avi. But all i get is: MEncoder Sherpya-SVN-r28311-4.2.5 (C) 2000-2009 MPlayer Team CPU: Intel(R) Core(TM)2 CPU T7600 @ 2.33GHz (Family: 6, Model: 15, Stepping: 6) CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1 Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

success: format: 16 data: 0x0 - 0x0 MF file format detected. mf? search expr: D:\Projekte\CodeSwarm?\frames\code_swarm-00001.png mf? number of files: 1 (4) VIDEO: MPNG? 800x600 24bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s) V? filefmt:16 fourcc:0x474E504D size:800x600 fps:25.000 ftime:=0.0400 Opening video filter: osd=1? Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1

Opening video decoder: ffmpeg? FFmpeg's libavcodec codec family Selected video codec: ffpng? vfm: ffmpeg (FFmpeg PNG decoder)

Flushing video frames. Filters have not been configured! Empty file? Writing index... Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

Video stream: nan kbit/s (-2147483648 B/s) size: 0 bytes 0.000 secs 0 frames

Does anyone can help me, or tell me wich tool is easyer to use under Windows?


Klaus Buchwald
Comment by webamoeba, May 16, 2009

I had some real problems with mencoder

Trying to get an alreayd compiled version for Windows took for ages - for anyone who is interested, if you download "Media Coder" mencoder and ffmpeg are bundled with it in the codecs folder.

For some reason it didn;t like PNGs, came out with what looked muvh like static on a TV. So I converted all the files to bitmaps, that solved that issue.

Then I had trouble getting mencoder to create a file that windows media player could read without any extra codecs. Here's the command line I used in the end that allowed me to do this:

mencoder "mf://code_swarm-.bmp" -mf fps=25 -o swarm.mpeg -ovc lavc -lavcopts vcodec=msmpeg4v2

Comment by maksim.galkin, Jun 20, 2009

Hey, everyone I am using Windows XP Mencoder was throwing exepctions on my machine, I didn't manage to get it up. So I just used a tool called VideoMach?... and I got the pretty decent results.


Enter a comment:

show hide Wiki markup help

*bold*     _italic_
`inline code`
escape: `*`

Indent lists 2 spaces:
  * bullet item
  # numbered list

verbatim code block

Horizontal rule

[http://domain/page label]

|| table || cells ||

More examples
Hosted by Google Code
当前网页内容, 由 大妈 ZoomQuiet 使用工具: ScrapBook :: Firefox Extension 人工从互联网中收集并分享;
若有不妥, 欢迎评注提醒:


点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

订阅 substack 体验古早写作:

关注公众号, 持续获得相关各种嗯哼:



关于 ~ DebugUself with DAMA ;-)
公安备案号: 44049002000656 ...::