Capture Sport Events to DVD with Embedded Game Clock

If you have seen the Olympics Basketball Final in Munich 1972 USSR vs USA you know that game clock is of the essence.

A bit more recent we have Michael Jordan Buzzer Beaters.

This article describes one way of getting the game clock on screen when you record a sport event. Follow this link to see ex. of videos.

For recording I use:

  • ASUS 5800 - an relatively old but powerful pc - Pentium4, 2800 MHz.
  • A low budget JVC GR-D720E DV Camera.
  • A Nautronic Scoreboard System, see, from which I have a serial connection to my ASUS.

On the ASUS I have this directory structure:

  • ./ffmpeg
  • ./pipmanipulator
  • ./gamevideo01
  • ./gamevideo02
  • ./scripts
  • etc.

./pipmanipulator holds a program (link to source!) that reads serial data from the Nautronic Scoreboard System and continually updates a file ("/mnt/ramdisk0/pipmanipulator.dat") with scoreboard information.

./ffmpeg holds a modified version of ffmpeg. (link to source!) Look for "tps" in source code to find modifications. The standard package ffmpeg is adjusted to use information from the file with scoreboard information. ffmpeg reads a number of bitmaps and put these bitmaps on screen, ie. see lower left part of image above. The bitmaps are created by the script before run of ffmpeg. ffmpeg picks up bitmaps at run time depending on values in the file with scoreboard information. Ie. if the score is 17 vs. 11 then bitmaps 17.bmp and 11.bmp are inserted to illustrate the score. There are bitmaps for all numbers, team names, logos, period etc. As mentioned all these bitmaps are created by prior to run of ffmpeg. Bitmaps are put on top of the DV input to ffmpeg. Hereby ffmpeg creates a picture in picture (pip). In script as well as in modified version of program ffmpeg bitmap manipulation is done using ImageMagick

./scripts holds various scripts I use for the record/burn process. Please see below.

Set up the environment to record video:

  • Get latest version of ffmpeg
  • Get ImageMagick
  • Ajust code so ffmpeg can handle the file with scoreboard information. See link above!
  • Before you compile the modified version of ffmpeg you must call ./configure with the following parameters - note that include ImageMagick ressources `./configure --enable-libx264 --enable-gpl --enable-libmp3lame --extra-cflags="`MagickWand-config --cflags`" --extra-cflags=`MagickWand-config --cppflags` --extra-ldflags="`MagickWand-config --ldflags`" --extra-ldflags="`MagickWand-config --libs`"`

The scripts I have to ease the record and burn process are:

Record video and burn to DVD.

  • Create new directory, ie. ./gamevideo03
  • Goto new directory
  • Call ../scripts/ Supply needed parameters. Usage: height namehome nameaway logohome logoaway
  • Call ../scripts/ If you get raw1394 - failed to get handle: Permission denied. then run chmod 777 /dev/raw1394 to enable access to device for video camera.
  • Call ../scripts/ Call for each sequence you want to capture. Typically I have one sequence for each quarter of a basketball game. Each sequence will turn into a chapter on the DVD making it easy to navigate the DVD.
    Note how the name of the output mpg file is set according to local time. This way you don't overwrite existing mpg files and files are sorted chronologically when put on DVD.
  • Call ../scripts/ cnce all the mpg files have been recorded
  • Call ../scripts/
  • Insert a blank DVD in your DVD burner, in my case /dev/scd1
  • Call ../scripts/

With the ASUS I am able to record a new game while burning the previous game. This speeds up the process if you have games coming right after each other and you still want to be able to deliver DVDs not to long after first game ended.


Successfull video recording!

I was out this last weekend and got six youth basketball games on DVD. I put scaled down versions of the games on basketball club's homepage for download and that did indeed created a lot of traffic.

If you have any questions don't hesitate to e-mail - tps at

Compile ffmpeg, add shot clock

The scoreboard equipment now includes a 24 sec. shot clock. To capture shot clock nautronic.c and the customized version of ffmpeg has been updated. I came across this introduction to compile ffmpeg with latest x264 under Ubuntu

Compile ffmpeg on Gentoo

The idea is to do a local compile where ffmpeg and additional libraries are installed in users home directory. I.e. use mp3 and x264 with ffmpeg so additional libraries libmp3lame and libx264 are needed. Basic software like subversion, wget and git is already installed.

  1. Create new directory ~/data/data/video
    Make a directory for ffmpeg and additional libraries.
  2. cd ~/data/data/video
  3. svn checkout svn:// ffmpeg
    Download ffmpeg into new subdirectory ffmpeg.
  4. wget
    Get tarball with libmp3lame.
  5. tar -xzvf lame-3.98.4.tar.gz
    Exract libmp3lame tarball into new subdirectory lame-3.98.4.
  6. cd lame-3.98.4
  7. ./configure -prefix=~/data/data/video/
    Configure libmp3lame and specify that libmp3lame should be installed in parent directory and not in /usr/lib
  8. make
    Compile libmp3lame
  9. make install
    Install libmp3lame in ~/data/data/video/
  10. cd ..
  11. git clone git://
    Donwload libx264 into new subdirectory x264.
  12. cd x264
  13. ./configure --enable-shared
    Configure libx264
  14. make
    Compile libx264. Libx264 is installed into current directory.
  15. cd ..
  16. cd ffmpeg
  17. ./configure --extra-cflags="-I ../include" --extra-cflags="-I ../x264" --extra-cflags="`MagickWand-config --cflags`" --extra-cflags="`MagickWand-config --cppflags`" --extra-ldflags="-L ../lib" --extra-ldflags="-L ../x264" --extra-ldflags="`MagickWand-config --ldflags`" --extra-ldflags="`MagickWand-config --libs`" --enable-libx264 --enable-gpl --enable-libmp3lame
    Configure ffmpeg. Tell ffmpeg to pick up libmp3lame in ../include and ../lib (header files and libraries in two different libraries). Tell ffmpeg to pick up libx264 in ../x264 (header files and libraries in the same directory)
    The references to MagickWand-config ensures that you are able to compile the modified verison of ffmpeg that does image manupulation with ImageMagick, see article above.
  18. make
    Compile ffmpeg.
  19. LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/data/data/video/lib:~/data/data/video/x264 ; export LD_LIBRARY_PATH
    We don't have libmp3lame and libx264 libraries in standard location, /usr/lib or /urs/local/lib so we have to set LD_LIBRARY_PATH so ffmpeg knows where to pick up the additional libraries at runtime.
  20. ./ffmpeg
    Run ffmpeg.

Scoreboard Video Filter for FFMPEG

Please see attached file for video filter for FFMPEG that places a scoreboard on top of a video. The video filter has been used to record basketball games.


1. Open terminal window
2. Create directory, ie. rec01, to hold video
3. Goto rec01
4. Create directory to hold bitmaps for scoreboard, ie scoreboardbitmaps
5. Goto scoreboardbitmaps
6. Create bitmaps running `bash` This script will create 143 bitmap files.
7. Go back to directory rec01
8. Call dvgrab and pipe output to ffmpeg `dvgrab –f dv - | ffmpeg –f dv –i - -vf “scoreboard=bitmap=scoreboardbitmaps” test.mpg