Fushicai USBTV007 - yet another Easycap clone

Post here to indicate any hardware you have used and which is known to work with ZoneMinder. Not for questions.
Post Reply
Nighthowl
Posts: 6
Joined: Sun Aug 11, 2013 1:46 am

Fushicai USBTV007 - yet another Easycap clone

Post by Nighthowl »

Some of the latest Easycap clones (originally with STK1160 chip) now come with the Fushicai USBTV007 chip, lsusb lists it as 1b71:3002. This must be the 4th or 5th different model sold in the same exact packaging that at first glance promises you the widely supported STK1160 aka Easycap/DC60 model.

Thanks to Lubomir Rintel's work on reverse engineering the windows driver there's already a preliminary driver/module available to compile and use this capture pen with zoneminder for example! So far only NTSC capture through the RCA connector is supported, but PAL will already "work" with some glitches.

I'm new to Linux so I had a hard time making this work. I'm reproducing here the steps I took so that every other linux challenged person :D that has this device can make it work without much trouble.

As I'm a new forum user I can't post off-site URL's :roll: , you'll need to replace the d0ts until that gets sorted out :oops:

Starting with a Ubuntu 12.04 server install, update to the latest kernel.
You can browse kernel d0t ubuntu d0t com/~kernel-ppa/mainline to check the latest version and update links accordingly. At the time of this writing it's 3.11 rc4.

If you have a 32bit install:

Code: Select all

wget -c kernel d0t ubuntu d0t com /~kernel-ppa/mainline/v3.11-rc4-saucy/linux-headers-3.11.0-031100rc4_3.11.0-031100rc4.201308041735_all.deb
wget -c kernel d0t ubuntu d0t com /~kernel-ppa/mainline/v3.11-rc4-saucy/linux-headers-3.11.0-031100rc4-generic_3.11.0-031100rc4.201308041735_i386.deb
wget -c kernel d0t ubuntu d0t com /~kernel-ppa/mainline/v3.11-rc4-saucy/linux-image-3.11.0-031100rc4-generic_3.11.0-031100rc4.201308041735_i386.deb

sudo dpkg -i *.deb
or 64bit:

Code: Select all

wget -c kernel d0t ubuntu d0t com /~kernel-ppa/mainline/v3.11-rc4-saucy/linux-headers-3.11.0-031100rc4_3.11.0-031100rc4.201308041735_all.deb
wget -c kernel d0t ubuntu d0t com /~kernel-ppa/mainline/v3.11-rc4-saucy/linux-headers-3.11.0-031100rc4-generic_3.11.0-031100rc4.201308041735_amd64.deb
wget -c kernel d0t ubuntu d0t com /~kernel-ppa/mainline/v3.11-rc4-saucy/linux-image-3.11.0-031100rc4-generic_3.11.0-031100rc4.201308041735_amd64.deb

sudo dpkg -i *.deb
Rebooting here will not hurt.

Code: Select all

shutdown -r now
make a dir and download the drivers (module) source code inside it:

Code: Select all

mkdir usbtv
cd usbtv
wget git d0t kernel d0t org/cgit/linux/kernel/git/torvalds/linux.git/plain/drivers/media/usb/usbtv/Kconfig
wget git d0t kernel d0t org/cgit/linux/kernel/git/torvalds/linux.git/plain/drivers/media/usb/usbtv/Makefile
wget git d0t kernel d0t org/cgit/linux/kernel/git/torvalds/linux.git/plain/drivers/media/usb/usbtv/usbtv.c
Get programs to compile the driver's (module) source code together with your brand spanking new kernel.

Code: Select all

apt-get install make
apt-get install gcc
To compile we need to edit the Makefile

Code: Select all

nano Makefile
edit the file with this text:

Code: Select all

obj-m += usbtv.o
KVERSION = $(shell uname -r)
all:
	make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
clean:
	make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
Make sure there is a TAB before the "make" lines, if it's spaces instead of a TAB it won't run the batch command and will return a "nothing to do" error.

Press Ctrl+O and [Enter] to output changes to the file. Ctrl+X to exit nano text editor.

Going super user here might be needed.

Code: Select all

sudo su
Run the compile command

Code: Select all

make
If all goes well you'll get a usbtv.ko file.

copy .ko to modules dir

Code: Select all

mkdir -p /lib/modules/$(uname -r)/kernel/drivers/media/usb/usbtv
cp usbtv.ko /lib/modules/$(uname -r)/kernel/drivers/media/usb/usbtv
update module dependency:

Code: Select all

depmod -a
now it's possible to load the module:

Code: Select all

modprobe usbtv
Connect the Easycap USB pen.

list loaded modules:

Code: Select all

lsmod 
There should be a usbtv module listed. If not, try rebooting.

Check if there's a new /dev/video folder:

Code: Select all

ls /dev/
In zoneminder configure as 30fps, NTSC, YUYV, even if the camera is PAL, it's the only way of getting it working right now.


Other observations:
If you have more than one capture device, like a bttv based capture card you have to define/fixate it's /dev/videoX path otherwise a reboot will change this in an arbitrary manner and you'll have to reconfigure the ZM device paths of your capture devices.
To see if you can pass this parameter to your capture card run

Code: Select all

modinfo bttv
or whatever the name of the driver/module of your card like modinfo saa7134.

If it has the following parameter listed:

Code: Select all

parm:           video_nr:video device number (array of int)
You can add it to the /etc/modprobe.d/whatever.conf file

For example in a bttv card

Code: Select all

options bttv video_nr=1
Will make the bttv card always list as /dev/video1

Another way is introducing in ZM the "Device Path" by its link inside the /dev/v4l/ folder instead of /dev/video#

Code: Select all

udevadm info -n /dev/video0 -qall | grep DEVLINKS
returns:

Code: Select all

E: DEVLINKS=/dev/v4l/by-id/usb-fushicai_usbtv007_300000000002-video-index0 /dev/v4l/by-path/pci-0000:00:02.2-usb-0:2:1.0-video-index0
In this case the link is:

Code: Select all

/dev/v4l/by-id/usb-fushicai_usbtv007_300000000002-video-index0
instead of /dev/video0 which might change with a reboot or removing/adding other capture devices.

This worked with the Easycap's device "by-id" link. It's useful since the driver still doesn't have a video_nr parameter at this stage. I had mixed results with the capture cards, it's best to just use the video_nr parameter.


Next steps:
Get this working in Android :D
rangerbob
Posts: 61
Joined: Sat Jun 06, 2009 3:40 am

Re: Fushicai USBTV007 - yet another Easycap clone

Post by rangerbob »

How many frames can this usb device do?
Nighthowl
Posts: 6
Joined: Sun Aug 11, 2013 1:46 am

Re: Fushicai USBTV007 - yet another Easycap clone

Post by Nighthowl »

With the latest version of the module (PAL support added on 2013-12-09 by Georg Kaindl), I get 25fps full D1 in zoneminder with a PAL cam on either RCA (channel 0) or S-video (channel 1) inputs. Zoneminder actually reports around 25.6 fps and the image is more stable if you set the maximum capture rate at 30 fps instead of 25 fps. I think the module, as it is, has issues lowering the frame capture rate. There's a long delay and temporal errors if you set the fps lower than 25.
If I try capturing from both inputs at the same time I get 12fps with interference between each input and on top of that S-video's colors and vertical lock have issues, it's unusable. Probably the chip takes too much time switching from RCA to S-Video signal. Reducing maximum frame rate and enabling 2 captures per frame gets fps down to 6 but problems remain about the same. I tried with capture buffer turned off and deinterlace set to 0 (auto).

Even if the module/driver still has space to mature I doubt the hardware will be able to support both channels at more than 2 fps for a full D1 frame, similar to other devices with one chip for multiple inputs, such as single bt848 based cards with 4 inputs.
kikebmt
Posts: 1
Joined: Thu Nov 10, 2016 7:08 pm

Re: Fushicai USBTV007 - yet another Easycap clone

Post by kikebmt »

Hello, thanks for all the information.

I am having errors running makefile

enrique usbtv # make
make -C /lib/modules/3.13.0-24-generic/build M=/usr/src/usbtv modules
make[1]: se ingresa al directorio «/usr/src/linux-headers-3.13.0-24-generic»
make[2]: *** No hay ninguna regla para construir el objetivo «/usr/src/usbtv/usbtv.c», necesario para «/usr/src/usbtv/usbtv.o». Alto.
make[1]: *** [_module_/usr/src/usbtv] Error 2
make[1]: se sale del directorio «/usr/src/linux-headers-3.13.0-24-generic»
make: *** [all] Error 2
The file available in git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/drivers/media/usb/usbtv/ is usbtv.h (no usbtv.c). I have tried to rename the file .h to .c, but this does not work (it could not be that easy)

Anybody can help me with this problem?
Post Reply