Enabling extra camera data formats

Forum for questions and support relating to the 1.24.x releases only.
Locked
Malvineous
Posts: 3
Joined: Sun Jun 14, 2009 8:27 am
Location: Brisbane, Australia

Enabling extra camera data formats

Post by Malvineous »

Hi all,

I've got a couple of old webcams I'd like to set up with ZoneMinder, but it seems that the cameras use data formats that aren't supported. One of them encodes the video in MJPEG format (which works fine with mplayer) and the other one uses PAC207, which is a proprietary compressed format.

I see in monitor.php there are entries for these formats, but they're commented out. I tried uncommenting them but it didn't help, I guess because they need to map to FFmpeg constants in zm_local_camera.cpp. (I would've thought MJPEG would've mapped though, given that mplayer uses FFmpeg's MJPEG decoder.)

At any rate, as I was hunting around I came across libv4l, which converts data from all cameras supported by Linux into a couple of standard formats. Given that this would allow both my webcams to work, I'm wondering whether there are any plans to use this library in ZoneMinder?

Or is there another way to get PAC207 cameras working?
mitch
Posts: 169
Joined: Thu Apr 30, 2009 4:18 am

Post by mitch »

actually if mplayer can play the mjpeg stream then it should work with ZM without issue. Just set the type to "FFMPEG" instead of remote, and plugin the url and it should work. There is a slight difference between mplayer and FFMPEG's mjpeg handling that has thrown some cameras, FFMPEG will always send auth auth header even if no user/pass is provided (it leaves the auth string blank) where mplayer only does it when a user/pass is provided. Long story short if FFMPEG doesn't work still try using http://a:a@camera so it provides a full auth string (even though invalid) to the webcam server and it may fix any lingering issues.
Malvineous
Posts: 3
Joined: Sun Jun 14, 2009 8:27 am
Location: Brisbane, Australia

Post by Malvineous »

Actually I did start looking into using FFMPEG that way, but as it's a USB camera, I can't figure out how you put "/dev/video1" into the source path...any suggestions?
mitch
Posts: 169
Joined: Thu Apr 30, 2009 4:18 am

Post by mitch »

source type FFMPEG, source path /dev/video1 should be all you need if it works with mplayer and its local, if that doesn't work see what errors are thrown with debugging on
User avatar
rdmelin
Posts: 863
Joined: Wed Oct 29, 2003 2:23 pm
Location: Ellensburg, WA USA

Post by rdmelin »

At any rate, as I was hunting around I came across libv4l, which converts data from all cameras supported by Linux into a couple of standard formats. Given that this would allow both my webcams to work, I'm wondering whether there are any plans to use this library in ZoneMinder?
Try this suggestion from user azir in this thread
http://www.zoneminder.com/forums/viewto ... 3462#53462
gspca kernel module supports many usb web cams, but sometimes it need help of libv4l2, try preload libv4l within zmdc.pl script
it works for me with my usb webcams (genius and prolink)
Code:

$ENV{PATH} = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
# preload libv4l2
$ENV{LD_PRELOAD} = '/usr/lib/libv4l/v4l2convert.so';
If this doesn't work I can put up a patch.
Malvineous
Posts: 3
Joined: Sun Jun 14, 2009 8:27 am
Location: Brisbane, Australia

Post by Malvineous »

Oh that's great, preloading libv4lconvert got my PAC207 camera working fine with its proprietary compressed protocol! (I just set the capture palette to RGB24.)

The MJPEG camera still doesn't work though, so I'll try switching it back to FFmpeg and enabling debug output. Strangely enough when I run ffmpeg from the command line with -i /dev/video1 FFmpeg just sits there not doing anything, so maybe it's a problem with FFmpeg accessing v4l2 devices? I imagine mplayer accesses the device itself and just passes the data through FFmpeg, as that seems to work fine.

I might have to look into libv4l though, if it doesn't support MJPEG properly...
Locked