Page 1 of 1

Hauppauge PVR150 working (concept)

Posted: Tue Mar 15, 2011 2:08 am
by robert999
I've spent quite a while trying to get my retired PVR-150 to work with Zoneminder. Many suggestions, but I couldn't get anything to work...until yesterday. I tried all variations of the source, using ffserver, using the video24 and video32 devices, etc. In the end, there are a few ways to make it work, but here's what I ended up with. In a nutshell, you create an updated jpeg for ZM to poll (file source).

This is a workaround, for sure, but the performance is adequate for what I'm looking for. I'm running this on an Ubuntu 10.10 LAMP server on an Athlon 1 GHz box. My PVR150 is the type that runs with ivtv drivers. I can probably list some code later for those that are interested, but here's the higher level view of what I did to get it to work:

1. Get your card working to the point that you can cat the /dev/video0 source to a file, and play the resulting mpeg in your player. e.g. $ sudo cat /dev/video0 > /tmp/file.mpg creates a file you can view in mplayer or Windows Media Player. You will need to use v4l2-ctl to set the input. I used "1" for S-Video. My camera is an old Sony Video8 Handycam (has NightShot), using the composite out going to the PVR150 S-video in.

2. Start a process that copies /dev/video0 to a named pipe.

3. Start ffmpeg to read from the pipe, and transcode the mpeg stream to a series of jpegs at a reasonable framerate, like 5. I used a size of 320x240. You could just read from the /dev/video0 device, but using the pipe let's you "tee" it (I'll explain why I chose this later in this post).

4. Run another process to look for the most recent jpeg created in the folder, and move it to a consistent filename, that same process deletes the older series of jpegs. Use pattern matching to simplify this.

5. Define your Monitor in ZM to use a file source, pointed to your jpeg's consistent filename in step 4. I used a framerate of 2, with an alarm of 5. Make sure to use the *same* size settings as what was created in step 3. I used 320x240, 24 bit color. If you use different size settings, you'll get a black screen.

If all is well, ZM will pull the current JPG from the file. The one process keeps creating more jpegs, and the other keeps the "consistent" one updated. You'll see the result on your monitor.

In my setup, I also wanted to take advantage of the fullsize, 30fps mpeg video output from the card. FFMPEG can't generate 30 fps of jpegs on an Athlon 1GHz using this method, but you can tee the pipe to have the mpeg stream both copy to the pipe, and write to an mpeg file. I then have the mpeg file switch every hour to keep the filesize reasonable, so that an hour's worth is about 1.5 GB (my bitrate is something like 3000 kbs and the native size is 720x576). When the whole shebang is running, it's using about 40% CPU on my 1 GHz Athlon.

I can use ZM to find events and peruse them, but if I want nicer, large frame, smooth video to inspect, I can also go find it in the mpeg files that were created. My camcorder has a date/time stamp so it helps finding your item of interest fairly easy.

Hopefully this helps some of you find new life with these older mpeg encoder cards. I'll take any comments that might simplify this.

Robert

Re: Hauppauge PVR150 working (concept)

Posted: Wed Mar 16, 2011 12:47 pm
by wkulecz
Clever, but it sure seems like a lot of work when you could just junk the PVR-150 and spend $30 for a Kworld DVD Maker USB 2.0 capture device and hook your handicam to it and get 30 fps or what ever lower rate you'd like.

I'm running four of them on Ubuntu 10.04 and so far they've worked very well, much better than either of my SAA713x based PCI cards have done with ZM.

Re: Hauppauge PVR150 working (concept)

Posted: Wed Mar 16, 2011 2:54 pm
by robert999
Good to know if someone doesn't want to mess with additional scripts. The hard part though, was trying everything to get something to work. Writing the scripts for the working solution was the easy part.

Again, this was just meant to show that it can be done if you want to make use of the existing hardware. If I wanted a *real* installation, I'd probably invest in a real security camera.

This is an old Abit KT7a that only supports USB 1.1 also. Any ideas on the Kworld device framerate an older mobo without USB2? That would be useful to know for old hardware.

Re: Hauppauge PVR150 working (concept)

Posted: Thu Mar 17, 2011 5:59 pm
by wkulecz
USB 1.1 barely supports 320x240 30 fps video. I have an old Haupauge WinTV USB. It does work with Linux but is mostly more trouble than its worth because of the poor bandwidth.

I'm not sure if the Kworld thing will even work with USB 1.1 I've no USB 1.1 ports to even try it with anymore, although the box under requirements lists: "one USB port, preferably USB 2.0"