Kodicom 4400R
Introduction
The Kodicom 4400R (or KMC-4400R) is a PCI interface card with 4 separate video capture ICs, handling 16 separate composite video (CVBS) inputs. This makes it ideal for Digital Video Recorder (DVR) projects that require inputs from 16 cameras. The video capture ICs (chips) used are of the Fusion 878A type from Conexant. These are commonly referred to by the older designation Bt878 so they use the bttv driver in the Linux kernel.
Other Kodicom Cards
There is also a card from Kodicom called the Kodicom 8800R (or KMC-8800) which has 8 capture chips. The Kodicom 4400R is very different in operation so the driver for it cannot be used with the 8800. There are many clones of both the 4400R and the 8800 out there including cards with references like SK-2003. Because the 4400R uses standard components they should work with the 4400R driver if they appear identical to the 4400R in appearance.
Installing the Card
The kernel is able to work with this card from version 2.6.12-6 onwards and is in the 2.6.13 kernel baseline. The driver treats one of the bt878A chips as the "master", and the other three as "slaves". To do this, two separate card types are used. Card 132 in the bttv cardlist is for the "master", and card 133 is for the slave. Unfortunately, at this time there is no automatic detection of this card, so the driver must be set to recognise the cards manually.
When the driver is installed, the "master" capture IC is the second controller detected, so the best way to install the driver is as a module with modprobe (or insmod) although it is possible to define module parameters at startup. For automatic loading at startup manually add the bttv module to the list of kernel modules loaded on boot (e.g in sysconfig), and add the options below to your modprobe config (e.g in modprobe.d or modprobe.conf)
modprobe:
modprobe bttv gbuffers=16 card=133,132,133,133
This should give you 4 video devices (/dev/video0 - /dev/video3), and you should be able to use them with any program, e.g. xawtv or whatever. Note the use of gbuffers which is increased from the standard 8 to 16, to give each channel a buffer of it's own. It may be necessary to increase gbuffers to the maximum of 32 if you have the memory available.
If bttv module takes too long (longer than a minute), you may try
options i2c-algo-bit bit_test=1
It reduced loading time from 100 seconds to only 2 on my AMD64x2.
Alternatively if the above option doesn't help, try disabling Infra-red polling which is unnecessary on this card - again makes it load in 2s instead of a minute in testing
options disable_ir=1
You may find the colour is quite washed out, as reported on the Zoneminder wiki [1]. Adding the chroma option as advised there fixed it for me. So my options for 4 channels (not needing the additional buffers is):
options bttv card=133,132,133,133 chroma_agc=1 disable_ir=1
Video Input Connections to the Card
The Kodicom 4400R card is able to process 16 composite video inputs. Here the 16 video inputs will be labelled Cam0 - Cam15. The 4 BNC connectors on the card are for Cam0, Cam1, Cam2 and Cam3 (Cam0 at the top). All 16 cameras can be connected through a 32-pin right angle pin header connector on the top of the card. The row of pins closest to the card are ground and the outside row are the connections for each camera with Cam0 on the left (looking down on the card from the component side). For Cam0 - Cam3 you can use either the pin header connector at the top of the card or the BNC connectors on the edge of the card for those 4 cameras - do not connect inputs to both at the same time though. The other 12 cameras (we'll call those Cam4 - Cam15) are only available from the connector on the top of the card. The card should be supplied with three separate PC card edge units with four BNC connnectors on each and a cable to connect each one to the pin header on top of the card.
Video Output Connection from the Card
The 4400R is unusual in that it is supplied with a video out connection on the card. This is a phono connector unlike the BNC connectors for video inputs. Any of the possible 16 video inputs can be fed to this output. The operation of this is using the crosspoint switch chip that the card is fitted with. Currently there is no method of setting which output it is connected to in the driver. Note that this card is often described as having one audio input but this is not the case, the phono connector (often red in colour) is for video output.
Audio Connections for this Card
There is no connectors available for audio inputs on this card. However on the board there are places for headers which have not been soldered in place. These are identified as CON2, CON4, CON6 and CON8 and provide an audio connection to the SFM input of each 878A chip.
Operation of the Card
There are only 4 physical Fusion 878A (commonly known as Bt878A) controller chips on the board, and with the Linux bttv driver under V4L they are labelled as /dev/video0 through /dev/video3 if it is the only capture card. The interesting part of the system is that any of the 16 cameras (Cam0 - Cam15) can be connected to any of the 4 controllers (/dev/video0 - /dev/video3). This is achieved by the use of a crosspoint video switch (CD22M3494MQ chip) on the board. This chip has got a 4-bit X address (X0 - X15) to reference any of the 16 inputs to the card and a 3-bit Y address (Y0 - Y7) which are under the control of GPIO pins on the master 878A chip. For this reason the driver of all four cards references the master device. Only four outputs (Y0 - Y3) are needed from the crosspoint switch and these connect to the MUX0 (and MUX1) input of the four 878A chips. The Y4 output is connected to the video output connector making it possible to view any input on the video output connector. However that is not currently under software control from the Linux bttv driver. By default, at initialisation, the driver connects Cam0 to /dev/video0, Cam1 to /dev/video1, etc. so that the four BNC connectors on the card itself are each connected to a different 878A device. This would allow for each of these channels to record at the full rate (25fps for PAL, 30fps for NTSC).
Requests to change input channels are in the range 0 to 15 and can be addressed to the device you want that channel to connect to. The driver automatically disconnects the previous input and connects the new channel as input to the chip addressed. Therefore it is possible to have all four devices (/dev/video0 - /dev/video3) connnected to the same input! It is important that two inputs are not fed to the same output at the one time and this prevents this. This arrangement also means that it is easier to have different capture rates with this card if fewer than all 16 inputs are used.
This card makes use of four LM1881 chips that determine which is odd and which are the even lines from the frame. There is one for each 878A and the state of the odd/even line output can be read from GPIO-16 although no use of this is made in the Linux driver.
There is also an LED beside each 878A which is driven from GPIO-23 pin. Again the Linux driver does not currently use the LED but it may use it to indicate which is the master 878A at initialisation at some stage in the future.
Using the Card with xawtv
Connect a camera to Cam0 and run xawtv. You should see the picture from the camera. Now "right click" on the picture to bring up the control panel. On the line labeled "Video Source" it says "Composite0" - that corresponds to Cam0. If you click on that, it will give you a drop-down box labeled "Input". Select "Composite1" and watch the picture disappear. Then change the camera connector to the next lower BNC connector (Cam1), and the picture should re-appear.
I assume you have at least two cameras around. Connect a second camera to Cam3 (the bottom BNC on the back of the card). With xawtv, verify that you can switch back and forth between the two (Cam1 and Cam3). Then, start up a second instance of xawtv, this time with
xawtv -device /dev/video1
By default, the driver "connects" Cam0 - 3 to /dev/video0 - /dev/video3, but by default xawtv re-initializes whatever controller it is using to Cam0, so this second instance gives you a blank / blue screen. Now "right click" on the picture and select "Composite3". The picture from Cam3 should appear.
You can continue like that, starting up to 4 instances of xawtv (one for each /dev/videoX), and use any of them to look at any of the (possibly 16) cameras.