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:
Navigation:
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:
BUGS:
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:
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".
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>