Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 
  2 Recording movies
  3 ================
  4 
  5 
  6 Audio
  7 =====
  8 
  9 If you don't get sound when recording avi movies, double-check the
 10 mixer settings first.  The record source defaults to micro on many
 11 linux sound drivers, you probably have to change this to line-in with
 12 one of the available mixer tools.  Some sound cards have a separate
 13 input gain control which needs to be set to some approximate value.
 14 Also keep in mind that ALSA has all mixer controls at 0 (i.e. muted)
 15 by default.
 16 
 17 /me uses kmix (because it doesn't need much space on the screen).
 18 The inputs where the sound cards record from have a red background
 19 color.  With the right mouse botton you'll get a menu where you can
 20 change the settings.  FreeBSD has a aumix version with X11 GUI in
 21 the ports collection which is very nice too (aumix-gtk in debian).
 22 
 23 If you want to see something while playing with the mixer settings you
 24 can use the record utility (ncurses terminal application, in the tools
 25 subdirectory), it has a nice input level meter.  motv has one build-in
 26 too (Menu -> Tools -> Record level monitor).
 27 
 28 Note on stereo:  xanim seems not be able to playback stereo sound
 29 correctly.
 30 
 31 
 32 Video
 33 =====
 34 
 35 Note that video recording does not work if the Xvideo extension is in
 36 use.  For recording stuff with xawtv you might have to start the
 37 application with the -noxv switch to disable Xvideo.
 38 
 39 xawtv/streamer handle video recording with multiple threads:
 40 
 41  - one thread records video (+ displays video on screen).
 42  - one (or more) thread(s) does color space conversion / compression.
 43  - one thread records audio (unless you do video only).
 44  - one thread writes the movie data to the disk.
 45  - one thread calls sync frequently to make the writeouts more
 46    smoothly (more smaller chunks instead of few very big ones).
 47 
 48 
 49 There are buffer fifo's between the recording threads and the
 50 compression / disk writer to avoid recording overruns due to a
 51 temporarily busy hard disk or CPU load peaks.
 52 
 53 If you see messages about a full fifo or about v4l(2) waiting for
 54 free buffers it is very likely that your hard disk is too slow,
 55 especially if you try to record uncompressed video.
 56 
 57 bttv 0.7.x allows you to use more than just two video buffers, you can
 58 configure the number at insmod time (gbuffers option).  Using more
 59 buffers (say 4-8 instead of just two which is the default) should help
 60 to reduce the number of dropped frames.
 61 
 62 If you want to record quicktime movies install libquicktime
 63 (http://libquicktime.sf.net), then (re-)build xawtv.  The configure
 64 script should find the library automatically.
 65 
 66 
 67 Known problems (and workarounds)
 68 ================================
 69 
 70 The timestamping for the video frames isn't very exact as it does
 71 _not_ come from the v4l(1) driver but is just a gettimeofday() call
 72 after receiving the video frame.  API design bug, needs fixing.
 73 With v4l2 xawtv uses the frame timestamps provided by the driver.
 74 
 75 
 76 Troubleshooting syncronisation problems
 77 =======================================
 78 
 79 A/V sync should simply work if your box can keep up with the data
 80 rate.  xawtv/streamer displays some debug info (time shift) on stderr.
 81 "a/r" is the difference between audio and real time, "a/v" is the
 82 difference between audio and video.
 83 
 84 Ff you see "fifo full" error messages your box likely can't keep up
 85 with the data rate.  Possible fixes: Try using more buffers.  Try
 86 recording compressed video.  Try tuning the hard disk using hdparm.
 87 Buy a faster hard disk.  Buy a faster computer.
 88 
 89 If xawtv/streamer says "queueing frame twice" it has put a the same
 90 video frame twice into the output queue to avoid video running out of
 91 sync.  If this happens a lot it indicates that either your computer
 92 can't keep up with compressing the frames or that your v4l device
 93 can't capture frames with the frame rate you are asking for.  A single
 94 message now and then is harmless.
 95 
 96 
 97 MPEG Encoding
 98 =============
 99 
100 Have a look at the mjpegtools (http://mjpeg.sourceforge.net).  xawtv
101 can write the yuv4mpeg format accepted by mpeg2enc directly.  mp2enc
102 accepts xawtv's wav files too.  So you can use xawtv/streamer,
103 mpeg2enc, mp3enc and mplex to build mpeg movies.
104 
105 If you don't have enough disk space to store uncompressed yuv video
106 you can also record compressed quicktime/avi files and then recode
107 stuff using lav2yuv + mpeg2enc in a pipe.  The streamer help text
108 (streamer -h) has a few examples.
109 
110 
111 Large Files
112 ===========
113 
114 xawtv has LFS support, i.e. it can write files >2GB without problems.
115 The AVI format has a 2GB limit.  There is a extension to overcome this
116 [http://www.matrox.com/videoweb/news/press/papers/odmlff2.pdf], but not
117 all applications can deal with it.  The quicktime format usually works
118 better as there is the quicktime4linux library everybody uses to
119 read/write *.mov files, thus there are less compatibility issues.
120 
121 
122 Read, Convert, Edit + Playback stuff
123 ====================================
124 
125 Recent xawtv versions come with the "pia" utility.  That is a simple
126 player which should be able to playback all AVI and QuickTime movies
127 recorded by xawtv, motv and streamer.
128 
129 avi format
130 
131  * xanim plays everything without problems.
132  * QuickTime[tm] (MacOS) plays the uncompressed formats just
133    fine and complains about mjpeg/jpeg.
134  * Windows Media Player plays the uncompressed formats fine.
135    mjpeg/jpeg work too if a codec is installed (/me has a very
136    old one from MainConcept).
137  * avifile can't deal with the uncompressed video correctly
138    [fixed in recent versions].
139    mjpeg/jpeg doesn't work either for me as it seems not to
140    recognise the MainConcept codec, although I've copied
141    stuff to /usr/lib/win32.  Maybe it works with another
142    one.
143  * MainActor (linux) can read the mjpeg but not the jpeg
144    compressed files.
145 
146 
147 quicktime format
148 
149  * xmovie + broadcast2000 can read the files without problems
150    (not exactly surprising as they use the quicktime4linux
151    library too ...).
152  * QuickTime[tm] (MacOS/Windows) plays them without problems.
153  * xanim says it can't find any data in the mov file.  It used
154    to work with older versions of the quicktime4linux library
155    (before 64bit support was added), so I suspect xanim simply
156    can't deal with 64bit mov files.
157 
158 
159 raw data
160 
161  * ImageMagick can deal with this, you have to specify the image
162    format + size on the command line like this:
163         display -size 320x240 rgb:file.raw
164    It can handle multiple frames in one big file too.
165 
166 
167 Have fun,
168 
169   Gerd
170 
171 -- 
172 Gerd Knorr <kraxel@bytesex.org>
  This page was automatically generated by the LXR engine.