Difference between revisions of "Zmodopipe"

From ZoneMinder Wiki
Jump to navigationJump to search
Line 65: Line 65:




Using
Using ffmpeg AND ffserver together. ffmpeg reads from the pipe, and sends the output to ffserver who serves it as an rtsp stream to ZM.
 
This gets more complex. Ffserver is a great program or was, until they decided to discontinue it. I won't explain ffserver here, but simply put, ffmpeg is unable to run a server of its own, so ffserver fills that role. You must use ffserver with ffmpeg in order to restream media.
 
Beware: [http://ffmpeg.gusari.org/viewtopic.php?f=12&t=2957&hilit=rtsp+segmentation+fault ffserver must be <3.1 in order to stream rtsp without a segfault].

Revision as of 22:20, 26 November 2016

ZmodoPipe

Zmodopipe is a tool that can take the stream from certain model of DVRs and provide that stream through a Named Pipe where programs, including Zoneminder (through zm_ffmpeg_camera.cpp) and ffmpeg can read that stream.

User Case

I purchased a Night Owl Poseidon DVR in the hopes of getting zmodopipe to work with it. This is what I found.

Equipment: Ubuntu 14.04, Zoneminder 1.30, Night Owl Poseidon DVR8, Zmodopipe .41, ffmpeg 3.0 compiled from source (used current ffmpeg ppa for libraries)

Setup

Follow forum guide steps. Download and compile.

There are various quirks not mentioned in the thread which serves as its documentation. A lot of people have been confused.

Running Dots: When you have zmodopipe running in verbose mode (-v flag) and connect sucessfully to the DVR you will see a stream of dots. This means the pipe is created and ready for a reader. At this point zmodopipe will be using 0% CPU and 0% Memory. This is normal for named pipes at this point.

Dots stopping: When you connect a reader (Zoneminder or ffmpeg) to the pipe, the dots will stop. Again, this is normal behavior. You should see some CPU usage on the program accessing the pipe.


A typical zmodopipe for the night owl can be: ./zmodopipe -s <ipaddressofdvr> -p 18004 -v -c 1 -u <admin> -a <pass> -m 1

./zmodopipe -h

will tell you the flags, as any good CLI program should.

You will need to make sure the password is set in the DVR. By default, there may not be a password. The night owl required a 6 character password (exactly 6 characters). The night owl is able to be factory reset.

After you run the zmodopipe command with verbose mode enabled, you will see the dots moving. Now it's time to read from the pipe.


Connecting to Zoneminder

Connecting to ZM with the recommended "Source: ffmpeg" settings provided in the forum post did not work for me reliably. I saw it work once, among dozens of attempts. It was 6 fps (very good). It may be that older ZM worked better with zmodopipe than it does now.


What Worked

Using cat to create a video from the pipe.

$ cat /tmp/zmodo0 > capture.mp4

Did work. VLC or mplayer was able to watch the video. But that makes a single encoded video. While useful, its not sufficient for my needs.


Using ffmpeg to read from the pipe and send it somewhere DID work. I was able to:

$ ffmpeg -f h264 -i /tmp/zmodo0 capture.mp4

$ ffmpeg -y -f h264 -i /tmp/zmodo0 -update 1 -vf fps=5 /tmp/image.jpg

The first option is the same result as cat, HOWEVER the second option creates an updating jpg. Zoneminder is able to read from the latter using Source:file getting roughly 1.2 fps. At times I would receive invalid data read from the stream, though, and this would mean that the latter option does not work 100% of the time.


Using ffmpeg AND ffserver together. ffmpeg reads from the pipe, and sends the output to ffserver who serves it as an rtsp stream to ZM.

This gets more complex. Ffserver is a great program or was, until they decided to discontinue it. I won't explain ffserver here, but simply put, ffmpeg is unable to run a server of its own, so ffserver fills that role. You must use ffserver with ffmpeg in order to restream media.

Beware: ffserver must be <3.1 in order to stream rtsp without a segfault.