POSitality
Posts: 23
Joined: Thu Aug 02, 2012 8:31 pm
Location: London

Simple CCTV: Webcam > RPi > Composite Video?

Mon Aug 06, 2012 12:08 pm

Hi guys,

I've searched about for mentions of using webcams for CCTV and it all gets bogged down with IP streaming and the like. I want to go back to basics:

Webcam (or the new on-board camera when it appears) plugged into the RPi. Video is sent directly to the Composite Video output (full screen) to your front room TV.

"Err... why do this, just buy a basic CCTV camera, they're all Composite Video!? Sheesh... why do we have to let the noobs on here!"

Aha! But your £30 crappy CCTV camera doesn't have a text overlay and even the ones that cost a bit more usually just have text for the camera name and maybe the date and time.

If we have a Cam + RPi we also have all the cleverness of Linux/Python/etc. at our fingertips. I'm thinking once Cam > RPi > TV is working I could add in some sort of text and/or graphic overlay to it...

Imagine you had a weather station running from your RPi (some people are already doing this) and the info (wind speed, temperature, high/low points etc.) was overlayed on the Webcam of your garden. BAM!!!! your own personal weather channel right in your front room. So simple, even the wife could understand it ;)

So really we've got Webcam > RPi > (insert amazing info text overlay) > TV > uberkewl!!!

Now... how we gonna do this? :D

Best Regards,

Andy

juanm
Posts: 1
Joined: Wed Aug 08, 2012 1:07 pm

Re: Simple CCTV: Webcam > RPi > Composite Video?

Wed Aug 08, 2012 1:11 pm

Hi! First post, so expect dumb questions from me! ;)

That's exactly one of the things I want to do, except that the webcam I have planned on using is connected by ethernet, so I'll keep an eye on this thread!

Try to look into cctv software like ZoneMinder.

Cheers

mnajera
Posts: 10
Joined: Tue Jul 24, 2012 6:45 pm

Re: Simple CCTV: Webcam > RPi > Composite Video?

Wed Aug 08, 2012 9:08 pm

juanm wrote:That's exactly one of the things I want to do, except that the webcam I have planned on using is connected by ethernet, so I'll keep an eye on this thread!
I've done a lot of work with both webcams and IP cameras under Linux, and I think that it's a bit easier to work with IP cameras (I'm assuming that your camera with an ethernet connection is one).

In general, IP cameras have basic web interfaces that allow the user to view live streams and adjust various options. They also tend to have CGI interfaces for everything, meaning that camera functionality is exposed by http commands like:

http://YOUR.CAMERAS.IP/camera-cgi/command?set_focus=100

Using libcurl with a few lines of code, you can talk to your camera and begin reading frames.

I encourage you to check out the documentation for your camera to see if CGI commands are available. You can then try to send commands to your camera via your browser, then transition those commands to code using libcurl and your language of choice.

POSitality
Posts: 23
Joined: Thu Aug 02, 2012 8:31 pm
Location: London

Re: Simple CCTV: Webcam > RPi > Composite Video?

Wed Aug 08, 2012 9:23 pm

Yeah, just trying out some webcam stuff now. Just got a cheap Creative Labs Sync as it said it was a UVC camera.

So far I've got it working with guvcview okay and looks fine. Just tried VLC and that doesn't show any video at all. However, I am connecting to the RPi via PuTTY and Xming. I did try through VNC as well. Maybe VLC only likes physical displays?

Just firing up motion to see what that's about... dunno what I'm doing but motion seems to be dumping JPEGs just fine, that was easy :)

Grrrr.... why won't VLC work, I know all the capabilities from the Windoze version :(

POSitality
Posts: 23
Joined: Thu Aug 02, 2012 8:31 pm
Location: London

Re: Simple CCTV: Webcam > RPi > Composite Video?

Wed Aug 08, 2012 9:30 pm

Um... IP cameras, you didn't actually read my post did you :(

KEEP IT SIMPLE :D

Webcams (or the RPi cam) are cheap and as simple as accessing /dev/video0. How many settings to get the same output from an IP camera? And can you tell me who sells them for £10?!

I'm going through all the video programs I can find to see which one can output /dev/video0 fullscreen to the composite output. Step 2 will be to combine with a user generated text or graphic overlay.

its_teej
Posts: 1
Joined: Fri Aug 02, 2013 5:48 pm

Re: Simple CCTV: Webcam > RPi > Composite Video?

Fri Aug 02, 2013 5:51 pm

Anyone had any luck with this?! I'd love to be able to overlay information/pictures/any graphics on a CCTV USB cam!!

txt3rob
Posts: 365
Joined: Sat Aug 11, 2012 3:45 pm
Contact: Website

Re: Simple CCTV: Webcam > RPi > Composite Video?

Tue Aug 06, 2013 10:39 am

will motion let you do this?
The Raspberry Pi Hell Guy - Random Ramblings to assist me and others.
http://raspberrypihell.blogspot.com
My Github - http:/www.github.com/random-robbie/
http://www.smspi.co.uk - send free uk sms via your raspberry pi from here

bbb
Posts: 55
Joined: Sat Jun 02, 2012 9:52 am

Re: Simple CCTV: Webcam > RPi > Composite Video?

Wed Aug 07, 2013 12:21 pm

I have played with motion, out the box the only output appears to be file based ( mjpeg stream, jpeg our movie clips).

I do have some C code working with the following pipeline: V4L -> SWscale (yuv420 to yuv411p) -> deinterlace -> OpenMAX h264 encoder.

It can substitute h264 for video_render component which outputs to HDMI and I guess the PIs composite output. Only tried HDMI but runs fullscreen at 25 fps :-)

HolmesChang
Posts: 12
Joined: Thu Mar 10, 2016 4:35 am
Location: Taiwan

Re: Simple CCTV: Webcam > RPi > Composite Video?

Fri Mar 11, 2016 3:03 pm

bbb wrote:I have played with motion, out the box the only output appears to be file based ( mjpeg stream, jpeg our movie clips).

I do have some C code working with the following pipeline: V4L -> SWscale (yuv420 to yuv411p) -> deinterlace -> OpenMAX h264 encoder.

It can substitute h264 for video_render component which outputs to HDMI and I guess the PIs composite output. Only tried HDMI but runs fullscreen at 25 fps :-)
Hi, I am also trying to do USB webcam -> RPi -> Composite Video. Moreover, I need to do some image processing between RPi -> Composite Video. In summary, I want to play processed webcam video to RCA port. I can do capturing image, image processing now, but have no idea how to play to RCA port with only video signal, not the whole desktop. It'll be a big help, if you can give me some hints.

Many thanks

bbb
Posts: 55
Joined: Sat Jun 02, 2012 9:52 am

Re: Simple CCTV: Webcam > RPi > Composite Video?

Sat Mar 12, 2016 10:26 pm

Managed to find an old SD card tucked away ... was a bit dusty :)

After cleaning up things quite a bit, I have pushed the code upto a project on gitlab.com here:
https://gitlab.com/raspivideo/raspiv4l

Basically, the code uses V4L (Video for Linux) API for capture and then does some processing on the ARM core using swscaler library and a custom de-interlacer.
Then pushes the video data into the broadcom VideoCore for x264 encoding, and the ability to read it back to the ARM core for either writing to file or a FIFO. Passing the -m option to the executable disables the x264 encoding and uses the video_renderer sink on the VideoCore -which will display the video over the top of what ever is being displayed (either from the console or X). I recommend dropping stright to the console for this sort of stuff.

I've updated things to work with the latest raspbian Jessie image. So far only tested a PI 2 B model with a playstation eye. I've had it working with a Pinnacle Dazzle DVC and some mixed results with a easycap DC60 dongle with STK1160 chipset (see here for more info: viewtopic.php?t=48599&p=389610).

Things I likely to do soon is 1) cleanup the source code 2) get the gprof profiling working again 3) test it with a original raspberry model B - yes the one with the usb poly fuses !

Return to “Graphics, sound and multimedia”