solution for cheap mpeg4 ip cams and others encoding input

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

solution for cheap mpeg4 ip cams and others encoding input

Post by nextime »

A way to get the stream from mpeg4 only capable ip cams ( or other encoding also ) captured in zm:

This way work better in terms of load and FPS than the method of save a single frame a time with mplayer in jpeg.

You need:
- ffmpeg
- vloopback (http://www.lavrsen.dk/twiki/bin/view/Mo ... backDevice)
- vpipe (http://download.astronomix.org/vpipe-0.0.2.tgz )

compile vloopback and modprobe it to create a v4l loopback device.
It create a videoN and videoN+1 couple of devices, /dev/video0 and /dev/video1 for example.
In this case, video0 is the input device, and video1 is the output device.

Now. with ffmpeg, do something like:

ffmpeg -i http://<ip_of_your_cam>/img/video.asf -r 8 -f rawvideo - | ./vpipe -f <format> -i 0
where 0 mean "/dev/video0"

Now you can simply create a monitor that point to /dev/video1 chan 0 whith the same resolution and color palette of your ffmpeg formatted output, and you get your cam work with zoneminder
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Post by nextime »

vloopback and vpipe for debian (packages compiled against sid)

deb http://packages.medianix.net/ mercury main

apt-get/aptitude install vpipe
m-a get vloopback-source
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Post by nextime »

A little and crappy python daemon to automagically setup vpipe + vloopback for multiple ip cams:

http://download.astronomix.org/ZMmpeg4.tgz

Read the "README" file inside the tarball.
blight
Posts: 6
Joined: Mon Aug 20, 2007 11:05 am

Post by blight »

Hi nextime

You seem to have hit exactly what I want to do.
I have set up ffmpeg and vloopback but I can't seem to figure out how to install vpipe and can't find any documentation on it?
I downloaded the package from http://download.astronomix.org/vpipe-0.0.2.tgz
but typing make says there is nothing to be done. I am trying to use your zmmpeg script which says it starts with no errors (I see ffmpeg processes running) but zoneminder gives the following in /var/log/messages:

Dec 4 23:01:15 hypnos zmwatch[2357]: INF [Restarting capture daemon for cam1, shared memory not valid]
Dec 4 23:01:16 hypnos zmdc[2314]: INF ['zmc -d /var/zmmpeg4/cam1' starting at 07/12/04 23:01:16, pid = 26719]
Dec 4 23:01:16 hypnos zmdc[26719]: INF ['zmc -d /var/zmmpeg4/cam1' started at 07/12/04 23:01:16]
Dec 4 23:01:16 hypnos zmwatch[2357]: INF ['zmc -d /var/zmmpeg4/cam1' starting at 07/12/04 23:01:16, pid = 26719]
Dec 4 23:01:16 hypnos zmc_dcam1[26719]: INF [Debug Level = 0, Debug Log = <none>]
Dec 4 23:01:16 hypnos zmc_dcam1[26719]: ERR [Failed to open video device /var/zmmpeg4/cam1: Invalid argument]
Dec 4 23:01:16 hypnos zmdc[2314]: ERR ['zmc -d /var/zmmpeg4/cam1' exited abnormally, exit status 255]
Dec 4 23:01:18 hypnos zmdc[2314]: WAR [Can't find process with command of 'zma -m']
Dec 4 23:01:19 hypnos zmdc[2314]: WAR [Can't find process with command of 'zmc -m']

Not sure what this is. Please forgive my ignorance.
Im running Fedora Core 7

I would really appreciate your help
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Post by nextime »

blight wrote:Hi nextime

You seem to have hit exactly what I want to do.
I have set up ffmpeg and vloopback but I can't seem to figure out how to install vpipe and can't find any documentation on it?
Ther's no documentation on vpipe, it's just a piece of code written by a my collegue in 2 hours to do the trick in zoneminder.

Anyway, all you need is to perform "make clean" and "make" if you have problems with it, anyway, you should be able to use it as already compiled, no library dependencies are required (except libc, of course).

To understand how to use it, you can do ./vpipe -i
Take care that "videodev-id" is the leading number of the device, for example, the "videodev-id" of /dev/video3 is "3".

You can simply pipe to it video output from ffmpeg like ffmpeg <options> | ./vpipe <options>.
blight wrote: I downloaded the package from http://download.astronomix.org/vpipe-0.0.2.tgz
but typing make says there is nothing to be done. I am trying to use your zmmpeg script which says it starts with no errors (I see ffmpeg processes running) but zoneminder gives the following in /var/log/messages:
ZMmpeg4 is also written in about 30 minutes to get things work what i want, but be care that it don't do any errore check, so, the thing that it start with no errors isn't so sure, at least not yet (maybe in future versions).

Anyway, you can try to check a simple ps aux and look if vpipe and ffmpeg are launched, and you can look on your dmesg to check if vloopback is loaded correctly.

Also, you can try to start ffmpeg and vpipe by hand in console copying the command line created by ZMmpeg4 in shell and look if all lool good.
blight wrote: Dec 4 23:01:15 hypnos zmwatch[2357]: INF [Restarting capture daemon for cam1, shared memory not valid]
Dec 4 23:01:16 hypnos zmdc[2314]: INF ['zmc -d /var/zmmpeg4/cam1' starting at 07/12/04 23:01:16, pid = 26719]
Dec 4 23:01:16 hypnos zmdc[26719]: INF ['zmc -d /var/zmmpeg4/cam1' started at 07/12/04 23:01:16]
Dec 4 23:01:16 hypnos zmwatch[2357]: INF ['zmc -d /var/zmmpeg4/cam1' starting at 07/12/04 23:01:16, pid = 26719]
Dec 4 23:01:16 hypnos zmc_dcam1[26719]: INF [Debug Level = 0, Debug Log = <none>]
Dec 4 23:01:16 hypnos zmc_dcam1[26719]: ERR [Failed to open video device /var/zmmpeg4/cam1: Invalid argument]
Dec 4 23:01:16 hypnos zmdc[2314]: ERR ['zmc -d /var/zmmpeg4/cam1' exited abnormally, exit status 255]
Dec 4 23:01:18 hypnos zmdc[2314]: WAR [Can't find process with command of 'zma -m']
Dec 4 23:01:19 hypnos zmdc[2314]: WAR [Can't find process with command of 'zmc -m']
Is there the simbolic link /var/zmmpeg4/cam1?
Is there also the device /dev/videoX linked by /var/zmmpeg4/cam1?

Can you launch mplayer or another videoplayer on it?

Have your zoneminder right permission to real /dev/videoX devices?
blight
Posts: 6
Joined: Mon Aug 20, 2007 11:05 am

Post by blight »

Thanks so much for getting back to me. It is really appreciated.
I will try all your suggestions and let you know.
Just one thing - please can you tell me where vpipe should be located in order for your zmmepg to use it? Or is it already part of the zmmpeg installation?

Thanks

Regards
Brendon
nextime
Posts: 23
Joined: Thu Nov 29, 2007 9:20 pm

Post by nextime »

Vpipe can be everywhere in the $PATH for run with ZMmpeg4.

I usually put it in /usr/bin
oscarliu
Posts: 7
Joined: Thu Nov 22, 2007 4:18 am

Post by oscarliu »

How about for a camera that needs authentication? ie.., where to put login name and password?
jaume85
Posts: 20
Joined: Mon Oct 06, 2008 5:13 pm

Post by jaume85 »

Hi,
I want to test route image with ffmpeg+vpipe+vloopback (noted above) to run on my network camera in ZM, but I don't know how do.
Someone could explain me step by step to do, please.

I also seen the ZMmpeg4, anyone tried? Does it work correctly?

Thanks for your help!
nmead
Posts: 1
Joined: Thu Jan 28, 2010 11:44 pm

VPipe?

Post by nmead »

Seems like the download links for vpipe are dead.

Anyone have a copy of the source or share an active dl link?
User avatar
kingofkya
Posts: 1110
Joined: Mon Mar 26, 2007 6:07 am
Location: Las Vegas, Nevada

Post by kingofkya »

See wiki on the subject. You will learn you don't need this anymore.
bartnovsky
Posts: 1
Joined: Mon Mar 15, 2010 11:53 am

Post by bartnovsky »

kingofkya wrote:See wiki on the subject. You will learn you don't need this anymore.
Do you mean that using ZoneMinder one can pipe from, lets say, IP camera to /dev/video* ?

If this is the case, would you explain how to do so or at least where is that written in wiki?

A nice job vpipe+vloopback might do (i didn't achieve it - that's why i am asking) is to pipe any video (rtsp-stream from CCTV or a movie from file) to /dev/video - and from there i could try to stream it using flumotion, skype or ekiga, because my aim is not to store video locally, but to (re)stream it.
User avatar
kingofkya
Posts: 1110
Joined: Mon Mar 26, 2007 6:07 am
Location: Las Vegas, Nevada

Post by kingofkya »

No only the kernal can add a /dev/video

but now that zoneminder has interrogated ffmpeg and mpeg4 vpipe is not required anymore.
diafygi
Posts: 1
Joined: Tue Apr 27, 2010 7:23 pm

Post by diafygi »

kingofkya wrote:but now that zoneminder has interrogated ffmpeg and mpeg4 vpipe is not required anymore.
Here is the release note that says this: 1.24.0
hik-user
Posts: 15
Joined: Fri Nov 12, 2010 2:07 am

Post by hik-user »

the download links for vpipe are deleted.

Anyone have a copy of the source or share an active dl link???
Post Reply