
   A project to write a video device frame capture program capable of
   saving image frames to disk at full speed (i.e. 25 frames/second of
   PAL).

   Download:
     * [1]video-capture-0.2.tar.gz to grab everything
     * [2]tlphoto.pl for taking timelapse photos

   Navigation:
     * [3]Return to Nick's projects page
     * [4]Return to Nick's homepage

   Copyright (C) 2001, Nick Andrew <nick@nick-andrew.net>
   Distributed under the terms of the GNU Public Licence

   The video-capture program started life as `vidcat.c', written by
   rasca@gmx.de and part of rasca's `w3cam' project. See
   http://www.rasca.de/

   It was useful for once-off capturing of a frame from a video capture
   device, but I wanted to do multiple-frame captures which would be
   suitable to feed into mpeg2encode. I also wanted a program which could
   capture all 25 frames per second (PAL). `vidcat.c' could not do that.
   Although other programs exist which can capture video and audio
   simultaneously I needed only a lightweight video-only capture program.

   While modifying this program I wrote video_device.h and video_device.c
   which provide an abstraction layer to controlling the video capture
   device. The abstraction is incomplete, but I learnt a lot about the
   Video4Linux API and it made video-capture.c easier to write and
   understand. The major advantage of using the abstraction is that it
   uses the double-buffering provided by all (?) video device drivers,
   such that the device driver is capturing the next frame while the user
   code is processing the previous frame.

   WHAT THE PROGRAM CAN DO:
     * capture single frame as ppm or jpeg
     * loop, capturing as quickly as it can, and writing to separate
       output files (frame%d.ppm or frame%d.jpg ?)
     * capture in various sizes, from certain device channels, in certain
       formats (i.e. PAL or NTSC)

   BUGS:
     * writing to separate output files is _very slow_ and unsuitable for
       25fps capture (at least on my machine). To do 25fps continuously,
       the program must write to a single file. There's a modification of
       mpeg2encode out there to read all frames from a single file, and a
       corresponding modification of a capture program to write that
       format. I have to go look for it again and do the same thing.
     * Full rate capture may also require multi-threading or a
       dual-process design (e.g. one process to capture and buffer the
       frames, another to write them to a file).
     * The names of the video input channels (the signal sources from
       which the card will capture) are hardcoded (a relic from vidcat.c)
       and apply to the bttv driver, but not necessarily any others.
       For example, the bttv driver and my card report the following
       channel names to me:
          + Channel 0: name Television, tuners 1, flags tuner audio, type
            tv, norm 0
          + Channel 1: name Composite1, tuners 0, flags audio, type
            camera, norm 0
          + Channel 2: name S-Video, tuners 0, flags audio, type camera,
            norm 0
       whereas these are hardcoded in video-capture.c as "tv", "comp1",
       "comp2", "s-video".
       However my USB video camera which uses the ov511.o device driver
       defines a single input channel which is called "Camera", numbered
       0.
       So to capture from the camera at this time, video-capture must be
       called with the "-i tv" option.
       To fix this, the program should query the device to obtain all
       channel names and compare them against the argument to "-i".
     * Setting the picture (brightness, colour etc) and tuning (TV
       channels) is not supported. Use xawtv to set all these parameters
       before running video-capture.

   TO BUILD:

   Just type "make", get in, sit down, shut up, hold on!

   Permissions required:

   Only read permission on the video device (/dev/video0 etc...)

   Enjoy!
   Nick Andrew <nick@nick-andrew.net>

References

   1. http://www.nick-andrew.net/projects/video-capture/video-capture-0.2.tar.gz
   2. http://www.nick-andrew.net/projects/video-capture/tlphoto.pl
   3. http://www.nick-andrew.net/projects/
   4. http://www.nick-andrew.net/
