EasyCAP for RaspberryPI

Discussion about this major DATV Project. See https://wiki.batc.org.uk/The_Portsdown_Transmitter
G8GKQ
Site Admin
Posts: 2928
Joined: Sun Mar 22, 2009 1:21 pm

Re: EasyCAP for RaspberryPI

Post by G8GKQ » Tue Mar 07, 2017 11:19 am

Hi Mark

Streaming from the EasyCap does not yet work properly. You can transmit from the EasyCap, or stream from the Pi Camera, but not stream from the EasyCap. It's in my Future Enhancements list here http://batc.org.uk/forum/viewtopic.php? ... 778#p11496

Grateful if anybody else can make it work! The code to play with is in /home/pi/scripts/a.sh

Dave, G8GKQ

G0EID
Posts: 25
Joined: Thu Oct 17, 2013 3:19 pm

Re: EasyCAP for RaspberryPI

Post by G0EID » Tue Mar 07, 2017 12:09 pm

The ANALOGCAM source is currently using the H264 encoder.
pi 4014 1 15 11:13 pts/0 00:00:19 /home/pi/rpidatv/bin/avc2ts -b 450784 -m 614379 -x 720 -y 576 -f 25 -i 100 videots -t 2 -e /dev/ezcap0 -p 255 -s BATC-rpidatv
root 4025 4013 0 11:13 pts/0 00:00:00 /home/pi/rpidatv/bin/ffmpeg -i videots -y -f flv rtmp://fms.batc.tv/live/....

The downside, as Noel pointed out, is that av2ts does not encode sound at the moment.

http://www.batc.org.uk/forum/viewtopic.php?f=69&t=4801

We might be able to implement an ANALOGMPEG-2 source, by duplicating most of the functionality of the CAMMPEG-2 source and changing the /dev/video device?

73
Dave

G8GKQ
Site Admin
Posts: 2928
Joined: Sun Mar 22, 2009 1:21 pm

Re: EasyCAP for RaspberryPI

Post by G8GKQ » Tue Mar 07, 2017 12:23 pm

Hi Dave

We don't need to use avc2ts to encode for the streamer. We could use ffmpeg, and I have compiled a new version which has the software H264 encoder in it, but just not had time to play with it. That would also solve the sound issue (although I do have a development version of AVC2TS that does encode sound as well - it's just not rock-solid enough to release yet)!

By all means play with implementing another source. I'll wrap it into the main build.

Dave, G8GKQ

F5SWB Dimitri
Posts: 39
Joined: Tue Feb 14, 2017 8:39 am

Re: EasyCAP for RaspberryPI

Post by F5SWB Dimitri » Tue Mar 07, 2017 3:42 pm

G0EID wrote:
F5SWB Dimitri wrote:It works for me now with :

in /etc/udev/rules.d/ezcap.rules :

SUBSYSTEM=="video4linux", ATTRS{idVendor}=="534d", ATTRS{idProduct}=="00212", MODE:="0660", SYMLINK+="ezcap0"

accordign to my key, I think it should works with other usb cap :)
Hi Dimitri,
I think there is a typo in your example above, please double check and let us know which line in the rules file works for you?

Yes I did an error to ATTRS it's "0021", not "00210"

Select the ANALOGCAM input source and use /dev/ezcap0 as the device name.

For me I use /dev/video1
73
Dimitri.

student
Posts: 1
Joined: Fri Apr 14, 2017 1:54 am

Re: EasyCAP for RaspberryPI

Post by student » Fri Apr 14, 2017 5:58 am

G0EID wrote:I think the problems lot of us are seeing is that the device node /dev/video0
is not always going to be pointing to the same physical device, it could point to the Pi Camera or the EzCAP?
It depends on what device is plugged-in or used first?

On my system with an EzCAP connected, during boot, it is assigned /dev/video0
The problem comes when we try to use the CAMMPEG2 input, the v4l driver for the Pi Camera is only loaded
at that point, and being the second video device found will be assigned /dev/video1

I have added a couple of files to my system.

/etc/modules-load.d/picamera.conf has just one line
bcm2835-v4l2
which loads the Pi Camera driver early so it gets to be /dev/video0.

And in /etc/udev/rules.d/ezcap.rules I put this line..

SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1b71", ATTRS{idProduct}=="3002", MODE:="0660", SYMLINK+="ezcap0"

This line is going to be different depending on which EzCAP device you have..
It makes a link /dev/ezcap0 device which will point either /dev/video0 or /dev/video1

The udev rule system is also used the support all the variations on the RTL-SDR devices,
Take a look at /etc/udev/rules.d/rtl-sdr.rules to see how it's done.

Maybe we can do the same thing to support all the EzCAP devices?

I found the information to configure my EzCAP rule like this:

# dmesg | grep usb

[ 1562.232450] usb 1-1.2: New USB device found, idVendor=1b71, idProduct=3002
[ 1562.232472] usb 1-1.2: New USB device strings: Mfr=3, Product=4, SerialNumber=2
[ 1562.232490] usb 1-1.2: Product: usbtv007
[ 1562.232505] usb 1-1.2: Manufacturer: fushicai
[ 1562.232521] usb 1-1.2: SerialNumber: 300000000002
[ 1562.243752] usbtv 1-1.2:1.0: Fushicai USBTV007 Audio-Video Grabber

And here is what it looks like, queried on my system, using v4l2-ctl
# v4l2-ctl -d 1 --all

Driver Info (not using libv4l2):
Driver name : usbtv
Card type : usbtv
Bus info : usb-3f980000.usb-1.2
Driver version: 4.4.26
Capabilities : 0x85200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x05200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Composite: ok)
Video Standard = 0x0000f900
PAL-M/60
NTSC-M/M-JP/443/M-KR
Format Video Capture:
Width/Height : 720/480
Pixel Format : 'YUYV'
Field : Interlaced
Bytes per Line: 1440
Size Image : 691200
Colorspace : Broadcast NTSC/PAL (SMPTE170M/ITU601)
Flags :
Streaming Parameters Video Capture:
Frames per second: 29.970 (30000/1001)
Read buffers : 2


Posting the output from these commands, from your systems, will help help Evariste build a set of rules
to make the EzCAP device names consistent across all rpidatv systems.

# dmesg | grep usb
# `v4l2-ctl -d 0 --all`
or
# `v4l2-ctl -d 1 --all`
Try device 0 and 1 if you are not sure which device is the EzCAP?

73
Dave - G0EID
@ Dave G0EID

In the configuration you suggested

SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1b71", ATTRS{idProduct}=="3002", MODE:="0660", SYMLINK+="ezcap0"

Understood the product ID and Vendor ID, but did not get MODE:="0660", is it permissons?

@All
Below is the details of my device, would like to know if any one tried this make of easycap out?
if so, please suggest the drivers to be loaded and their source to get this piece of silicon working.
Thanks in Advance!

The output of dmesg | grep usb

[ 3.830216] usb 1-1.5: New USB device found, idVendor=534d, idProduct=0021
[ 3.830234] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 3.830247] usb 1-1.5: Product: AV TO USB2.0
[ 3.830260] usb 1-1.5: Manufacturer: MACROSIL

and output of v4l2-ctl -d 0 --all

Driver Info (not using libv4l2):
Driver name : uvcvideo
Card type : AV TO USB2.0
Bus info : usb-3f980000.usb-1.5
Driver version: 4.4.38
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
Width/Height : 720/480
Pixel Format : 'YUYV'
Field : None
Bytes per Line: 1440
Size Image : 691200
Colorspace : Unknown (00000000)
Flags :
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 720, Height 480
Default : Left 0, Top 0, Width 720, Height 480
Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 720, Height 480
Selection: crop_bounds, Left 0, Top 0, Width 720, Height 480
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (30/1)
Read buffers : 0
brightness (int) : min=0 max=255 step=1 default=-8193 value=32
contrast (int) : min=0 max=255 step=1 default=57343 value=128
saturation (int) : min=0 max=255 step=1 default=57343 value=128
hue (int) : min=0 max=127 step=1 default=-8193 value=0
gamma (int) : min=0 max=50 step=1 default=57343 value=0
brightness (int) : min=0 max=255 step=1 default=-8193 value=32
contrast (int) : min=0 max=255 step=1 default=57343 value=128
saturation (int) : min=0 max=255 step=1 default=57343 value=128
hue (int) : min=0 max=127 step=1 default=-8193 value=0
gamma (int) : min=0 max=50 step=1 default=57343 value=0
73s
VU3JBC

G8GKQ
Site Admin
Posts: 2928
Joined: Sun Mar 22, 2009 1:21 pm

Re: EasyCAP for RaspberryPI

Post by G8GKQ » Fri Apr 14, 2017 7:55 pm

Hi VU3JBC

Your EasyCap is listed in this post http://www.batc.org.uk/forum/viewtopic. ... 788#p11524, and similar ones have worked well with the Portsdown transmitter. The key info is idVendor=534d, idProduct=0021

G0EID's modifications are only required if you want the EasyCap to always be /dev/video1. I have not included these modifications in the core build because they do not work well if you boot without a PiCam connected.

You should be able to simply connect your EasyCap to a Portsdown transmitter, boot up, select ANALOGCAM and it will work. The drivers required are already loaded.

Dave, G8GKQ

Post Reply

Return to “The Portsdown Digital ATV System”