NewVideoRecorder is a high quality video capture toolkit for Linux. At the moment it supports v4l1 and v4l2 devices as video sources, oss and alsa as an audio source. It can output to quicktime (in RTjpeg, YUV2, or RAW format, and most ffmpeg formats), AVI (in DivX format), NuppelVideo format, MPEG-1, and streaming multicast/unsicast.
nvrec includes deep buffering to minimise frame drops, in high load situations, and a smooth framedropping algorithm to keep the video as smooth as possible if you do have to drop frames.
It also has a audio "stretcher" to write the exact amount of audio to the output file (this compensates for lack of clock synch between video and audio cards). nvrec is written in an extremely modular way, to make it easy to integrate with existing applications, or add your own output formats.
This engine makes use of deep buffers (2 seconds+) for audio and video. The video is buffered in the driver to avoid too many costly userspace copies. The audio is buffered in a userspace ring buffer. This is expensive, but neccessary, as OSS drivers are often limited to very short buffers.
All buffers are accurately timestamped as they are received: video buffers by the kernel, and audio buffers by gettimeofday() (offset by the current depth of the kernel buffer). At the start, audio or video is dropped until both are in sync, and from then on, only audio and video timestamped for the same period is processed.
Since there will be clock drift between the audio capture and video capture cards, the audio stream is dynamically warped so that exactly the right amount of audio is placed in the output file for each video frame written to the file (NOTE: At the moment the warping is done by a simple line algorithm - could do a lot better here). A simple P-I controller adjusts the warping factor to keep sync.
The code tries to keep the internal buffers between 10% (to make sure we never run out of data) and 40% (to make sure we don;t have uncontrolled dropping) full. When the buffer is less than 10% full, it simply sleeps 1 frame period. When the buffer is more than 40% full, it gradually drops more frames per sencond, until a stable point is reached.
The code is designed to be very modular, so there should be no problem adding an alsa core.
There are currently five output cores: qtfile_core, which produces RTjpeg, YUV2 or RAW encoded quicktime files; divxfile_core, which produces DivX encoded avi files; nuvfile_core, which produces NuppelVideo0.4 files; rtefile_core, which produces mpeg-1 program streams; and ffmpegfile_core, which produces a lot of types of files, like mpeg4, mpeg2, mpeg1, wmv, dv, h263... (see documentation in ffmpeg.sf.net).
What's New in This Release:
· Added support for recording radio (in devices with support for that
· Fixed ffmpegrec support, updating the code to use the new libavcodec api and new libavformat api (ffmpeg cvs release 2004-07-09 checked)
· Fixed some bugs in the calls to v4l2 api (kernel 2.6.4).
· Added support for split files on the fly, by specify the size of each chunk and the basename used for each file.
· Fixed some compile warnings. The code compiles without problems in gcc 2.95 and gcc 3.3.