Recording movies ================ Audio ===== If you don't get sound when recording avi movies, double-check the mixer settings first. The record source defaults to micro on many linux sound drivers, you probably have to change this to line-in with one of the available mixer tools. Some sound cards have a separate input gain control which needs to be set to some approximate value. Also keep in mind that ALSA has all mixer controls at 0 (i.e. muted) by default. /me uses kmix (because it doesn't need much space on the screen). The inputs where the sound cards record from have a red background color. With the right mouse botton you'll get a menu where you can change the settings. FreeBSD has a aumix version with X11 GUI in the ports collection which is very nice too (aumix-gtk in debian). If you want to see something while playing with the mixer settings you can use the record utility (ncurses terminal application, in the tools subdirectory), it has a nice input level meter. motv has one build-in too (Menu -> Tools -> Record level monitor). Note on stereo: xanim seems not be able to playback stereo sound correctly. Video ===== Note that video recording does not work if the Xvideo extension is in use. For recording stuff with xawtv you might have to start the application with the -noxv switch to disable Xvideo. xawtv/streamer handle video recording with multiple threads: - one thread records video (+ displays video on screen). - one (or more) thread(s) does color space conversion / compression. - one thread records audio (unless you do video only). - one thread writes the movie data to the disk. - one thread calls sync frequently to make the writeouts more smoothly (more smaller chunks instead of few very big ones). There are buffer fifo's between the recording threads and the compression / disk writer to avoid recording overruns due to a temporarily busy hard disk or CPU load peaks. If you see messages about a full fifo or about v4l(2) waiting for free buffers it is very likely that your hard disk is too slow, especially if you try to record uncompressed video. bttv 0.7.x allows you to use more than just two video buffers, you can configure the number at insmod time (gbuffers option). Using more buffers (say 4-8 instead of just two which is the default) should help to reduce the number of dropped frames. If you want to record quicktime movies install libquicktime (http://libquicktime.sf.net), then (re-)build xawtv. The configure script should find the library automatically. Known problems (and workarounds) ================================ The timestamping for the video frames isn't very exact as it does _not_ come from the v4l(1) driver but is just a gettimeofday() call after receiving the video frame. API design bug, needs fixing. With v4l2 xawtv uses the frame timestamps provided by the driver. Troubleshooting syncronisation problems ======================================= A/V sync should simply work if your box can keep up with the data rate. xawtv/streamer displays some debug info (time shift) on stderr. "a/r" is the difference between audio and real time, "a/v" is the difference between audio and video. Ff you see "fifo full" error messages your box likely can't keep up with the data rate. Possible fixes: Try using more buffers. Try recording compressed video. Try tuning the hard disk using hdparm. Buy a faster hard disk. Buy a faster computer. If xawtv/streamer says "queueing frame twice" it has put a the same video frame twice into the output queue to avoid video running out of sync. If this happens a lot it indicates that either your computer can't keep up with compressing the frames or that your v4l device can't capture frames with the frame rate you are asking for. A single message now and then is harmless. MPEG Encoding ============= Have a look at the mjpegtools (http://mjpeg.sourceforge.net). xawtv can write the yuv4mpeg format accepted by mpeg2enc directly. mp2enc accepts xawtv's wav files too. So you can use xawtv/streamer, mpeg2enc, mp3enc and mplex to build mpeg movies. If you don't have enough disk space to store uncompressed yuv video you can also record compressed quicktime/avi files and then recode stuff using lav2yuv + mpeg2enc in a pipe. The streamer help text (streamer -h) has a few examples. Large Files =========== xawtv has LFS support, i.e. it can write files >2GB without problems. The AVI format has a 2GB limit. There is a extension to overcome this [http://www.matrox.com/videoweb/news/press/papers/odmlff2.pdf], but not all applications can deal with it. The quicktime format usually works better as there is the quicktime4linux library everybody uses to read/write *.mov files, thus there are less compatibility issues. Read, Convert, Edit + Playback stuff ==================================== Recent xawtv versions come with the "pia" utility. That is a simple player which should be able to playback all AVI and QuickTime movies recorded by xawtv, motv and streamer. avi format * xanim plays everything without problems. * QuickTime[tm] (MacOS) plays the uncompressed formats just fine and complains about mjpeg/jpeg. * Windows Media Player plays the uncompressed formats fine. mjpeg/jpeg work too if a codec is installed (/me has a very old one from MainConcept). * avifile can't deal with the uncompressed video correctly [fixed in recent versions]. mjpeg/jpeg doesn't work either for me as it seems not to recognise the MainConcept codec, although I've copied stuff to /usr/lib/win32. Maybe it works with another one. * MainActor (linux) can read the mjpeg but not the jpeg compressed files. quicktime format * xmovie + broadcast2000 can read the files without problems (not exactly surprising as they use the quicktime4linux library too ...). * QuickTime[tm] (MacOS/Windows) plays them without problems. * xanim says it can't find any data in the mov file. It used to work with older versions of the quicktime4linux library (before 64bit support was added), so I suspect xanim simply can't deal with 64bit mov files. raw data * ImageMagick can deal with this, you have to specify the image format + size on the command line like this: display -size 320x240 rgb:file.raw It can handle multiple frames in one big file too. Have fun, Gerd -- Gerd Knorr <kraxel@bytesex.org>