mpeg camera's in zoneminder 1.23.3 using ffmpeg
mpeg camera's in zoneminder 1.23.3 using ffmpeg
I have seen there is support for mpeg4 camera's in the next version, but i have made an replacement zm_remote_camera.cpp for ZoneMinder 1.23.3 using ffmpeg for decoding, but also for the network part.
As a bonus it gives me a lower load on the mjpeg camera's i am using at the moment.
http://dejonge.tv/archives/17
regards,
Gert-Jan
As a bonus it gives me a lower load on the mjpeg camera's i am using at the moment.
http://dejonge.tv/archives/17
regards,
Gert-Jan
-
- Posts: 440
- Joined: Sat Sep 25, 2004 12:45 am
- Location: Fulton, MO
Re: mpeg camera's in zoneminder 1.23.3 using ffmpeg
Neat stuff.
gertjan wrote:I have seen there is support for mpeg4 camera's in the next version, but i have made an replacement zm_remote_camera.cpp for ZoneMinder 1.23.3 using ffmpeg for decoding, but also for the network part.
As a bonus it gives me a lower load on the mjpeg camera's i am using at the moment.
http://dejonge.tv/archives/17
regards,
Gert-Jan
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
Re: mpeg camera's in zoneminder 1.23.3 using ffmpeg
This is very impressive. I will take a good look at this as you may well have found a better way of doing it provided ffmpeg supports all the other little wrinkles.gertjan wrote:I have seen there is support for mpeg4 camera's in the next version, but i have made an replacement zm_remote_camera.cpp for ZoneMinder 1.23.3 using ffmpeg for decoding, but also for the network part.
As a bonus it gives me a lower load on the mjpeg camera's i am using at the moment.
http://dejonge.tv/archives/17
regards,
Gert-Jan
Phil
Re: mpeg camera's in zoneminder 1.23.3 using ffmpeg
What i noticed up to now:zoneminder wrote: This is very impressive. I will take a good look at this as you may well have found a better way of doing it provided ffmpeg supports all the other little wrinkles.
* it takes quite a few seconds before the cam is initialized and streaming
* mjpg cameras work best by adding a dummy ?/&.mjpg at the end of the url
Thank you Gert Jan for this hack
A few changes I was made to the file are:
Please, replace every SLASH word with / and DOT with . because forum striped this characters
From:
To:
And just above the above lines (extern "C") I was added these lines:
because I get INT64_C errors:
http://ilab.usc.edu/cgi-bin/yabb/YaBB.p ... 1173913186
A few changes I was made to the file are:
Please, replace every SLASH word with / and DOT with . because forum striped this characters
From:
Code: Select all
extern "C" {
#include <libavcodecSLASHavcodecDOTh>
#include <libavformatSLASHavformatDOTh>
#include <libswscaleSLASHswscaleDOTh>
}
Code: Select all
extern "C" {
#include <ffmpegSLASHavcodecDOTh>
#include <ffmpegSLASHavformatDOTh>
#include <ffmpegSLASHswscaleDOTh>
}
And just above the above lines (extern "C") I was added these lines:
Code: Select all
#define INT64_C
#define __STDC_CONSTANT_MACROS
#include <stdintDOTh>
http://ilab.usc.edu/cgi-bin/yabb/YaBB.p ... 1173913186
I can compile but I can't test because I have a remote camera with a password.
I have found a few mpeg4 free cameras to test:
http://www.midisec.com/index.php?option ... &Itemid=55
So, at Hostname I use:
demo:demo@midisec.com
Port:
2010
Source:
rtsp://midisec.com/live.sdp
Is this correct?
BTW: If ffmpeg support mpeg4, with x264 library it will support H.264 decoding?
I have found a few mpeg4 free cameras to test:
http://www.midisec.com/index.php?option ... &Itemid=55
So, at Hostname I use:
demo:demo@midisec.com
Port:
2010
Source:
rtsp://midisec.com/live.sdp
Is this correct?
BTW: If ffmpeg support mpeg4, with x264 library it will support H.264 decoding?
At this moment, the code does not actively use the port or the host part. My best geuss is to test with the ffmpeg commandline player (ffplay) use f.e.:Normando wrote:I can compile but I can't test because I have a remote camera with a password.
I have found a few mpeg4 free cameras to test:
http://www.midisec.com/index.php?option ... &Itemid=55
So, at Hostname I use:
demo:demo@midisec.com
Port:
2010
Source:
rtsp://midisec.com/live.sdp
Is this correct?
BTW: If ffmpeg support mpeg4, with x264 library it will support H.264 decoding?
ffplay rtsp://midisec.com/live.sdp
ffplay rtsp://midisec.com:2010/live.sdp
ffplay rtsp://demo:demo@midisec.com:2010/live.sdp
my hope is indeed to be able to also read h264 cameras but i have no h264 camera to test.
Last edited by gertjan on Wed Nov 19, 2008 6:33 pm, edited 1 time in total.
I have checked a "Digi-Lan CMOS network camera LAN" TV7203 which I believe is based on the same firmware as the vivo camera's.
ffplay rtsp://x.x.x.x/live.sdp works fine (this is what i use in my own setup)
ffplay rtsp://x.x.x.x:2010/live.sdp works fine
ffplay rtsp://demo:demo@x.x.x.x:2010/live.sdp gives errors in the header.
So at the moment you should be able to access camera's on non default ports. but at least with rtsp username/password does not work.
you can also try openRTSP to first receive the camera:
openRTSP -b 80000 -c -d 60 -v -u demo demo rtsp://midisec.com:2010/live.sdp
I have tried all the cameras on the list on the midisec site, but i cannot receive any of them unfortunately.
see also http://www.zoneminder.com/forums/viewtopic.php?t=11475
ffplay rtsp://x.x.x.x/live.sdp works fine (this is what i use in my own setup)
ffplay rtsp://x.x.x.x:2010/live.sdp works fine
ffplay rtsp://demo:demo@x.x.x.x:2010/live.sdp gives errors in the header.
So at the moment you should be able to access camera's on non default ports. but at least with rtsp username/password does not work.
you can also try openRTSP to first receive the camera:
openRTSP -b 80000 -c -d 60 -v -u demo demo rtsp://midisec.com:2010/live.sdp
I have tried all the cameras on the list on the midisec site, but i cannot receive any of them unfortunately.
see also http://www.zoneminder.com/forums/viewtopic.php?t=11475
extra method for rtsp cameras
At this moment i see some problems with the rtsp code as used in ffmpeg.
best solution to use rtsp camera's at the moment is the openRTSP work around:
1. create a pipe ( f.e. mkpipe /tmp/pipes/achterterrein.pipe )
2. change owner of pipe to the user you use for running zoneminder (f.e. chown nobody /tmp/pipes/achterterrein.pipe )
3. use the path to the pipe as input path for the camer, enter camera ip en port number dummy values.
4. start openRTSP to stream video to the pipe
I put my openRTSP commands in the inittab, so they are automatically restarted, check your own camera's so your buffer is large enough:
g1:3:respawn:/usr/bin/openRTSP -t -b 40000 -v rtsp://x.x.x.x/mpeg4/media.amp > /tmp/pipes/achterterrein.pipe
g2:3:respawn:/usr/bin/openRTSP -t -b 100000 -v rtsp://x.x.x.x/live.sdp > /tmp/pipes/mpeg4.pipe
g3:3:respawn:/usr/bin/openRTSP -t -b 100000 -v rtsp://x.x.x.x/live.sdp > /tmp/pipes/lesruimte.pipe
With this work around I have al my rtsp cameras working like a charm. With openRTSP you can also add username and password [-u <username> <password>].
camera's working for me at the moment:
axis 2120, http://x.x.x.x/mjpg/video.mjpg?resoluti ... ps=5&.mjpg
axis 2110, http://x.x.x.x/mjpg/video.mjpg?resoluti ... &fmt=.mjpg
axis 2100, http://x.x.x.x/mjpg/video.mjpg?resolution=640x480&.mjpg
axis 210, rtsp://x.x.x.x/mpeg4/media.amp best via openRTSP workaround
Mobotix M1, http://x.x.x.x/cgi-bin/faststream.jpg?.mjpg
Abus T7204 & T7203, rtsp://x.x.x.x/live.sdp best via openRTSP workaround
Sony SNC-M3W, http://x.x.x.x/img/video.asf
AVTECH AVI203 h264 cam, rtsp://x.x.x.x/live/h264 best via openRTSP workaround
Hope this helps
regards,
Gert-Jan
best solution to use rtsp camera's at the moment is the openRTSP work around:
1. create a pipe ( f.e. mkpipe /tmp/pipes/achterterrein.pipe )
2. change owner of pipe to the user you use for running zoneminder (f.e. chown nobody /tmp/pipes/achterterrein.pipe )
3. use the path to the pipe as input path for the camer, enter camera ip en port number dummy values.
4. start openRTSP to stream video to the pipe
I put my openRTSP commands in the inittab, so they are automatically restarted, check your own camera's so your buffer is large enough:
g1:3:respawn:/usr/bin/openRTSP -t -b 40000 -v rtsp://x.x.x.x/mpeg4/media.amp > /tmp/pipes/achterterrein.pipe
g2:3:respawn:/usr/bin/openRTSP -t -b 100000 -v rtsp://x.x.x.x/live.sdp > /tmp/pipes/mpeg4.pipe
g3:3:respawn:/usr/bin/openRTSP -t -b 100000 -v rtsp://x.x.x.x/live.sdp > /tmp/pipes/lesruimte.pipe
With this work around I have al my rtsp cameras working like a charm. With openRTSP you can also add username and password [-u <username> <password>].
camera's working for me at the moment:
axis 2120, http://x.x.x.x/mjpg/video.mjpg?resoluti ... ps=5&.mjpg
axis 2110, http://x.x.x.x/mjpg/video.mjpg?resoluti ... &fmt=.mjpg
axis 2100, http://x.x.x.x/mjpg/video.mjpg?resolution=640x480&.mjpg
axis 210, rtsp://x.x.x.x/mpeg4/media.amp best via openRTSP workaround
Mobotix M1, http://x.x.x.x/cgi-bin/faststream.jpg?.mjpg
Abus T7204 & T7203, rtsp://x.x.x.x/live.sdp best via openRTSP workaround
Sony SNC-M3W, http://x.x.x.x/img/video.asf
AVTECH AVI203 h264 cam, rtsp://x.x.x.x/live/h264 best via openRTSP workaround
Hope this helps
regards,
Gert-Jan
Last edited by gertjan on Tue Dec 02, 2008 9:29 pm, edited 1 time in total.
Re: extra method for rtsp cameras
This camera is AVTECH AVI203gertjan wrote: (yet unkown brand) h264 cam, rtsp://x.x.x.x/live/h264 best via openRTSP workaround
Do you try mpeg4 from avtech? the url is /live/m.peg4 <- see the dot
Other mothels from avtech like AVI201 use /live/mpeg4 without the dot.
I have try mpeg4, but allway I see the scrren splitted by two. Strange, but I will test again.
Thank you Gert Jan for your work.
- zoneminder
- Site Admin
- Posts: 5215
- Joined: Wed Jul 09, 2003 2:07 pm
- Location: Bristol, UK
- Contact:
I thought you might be interested that the latest release candidate for 1.24.0 now includes an ffmpeg monitor type which essentially implements a similar process to that described above in that any path can be assigned and that is passed directly to ffmpeg for processing. Please see the last post in this thread for details. Thanks to gertjan for his original post which was part of the inspiration for this.
Also I submitted a patch to ffmpeg to permit urls with authentication of the form of user:pass@hostname/path to be correctly authenticated which should fix some of the issues described in earlier posts. The patch has now been accepted and should be available in the latest ffmpeg via svn.
Also I submitted a patch to ffmpeg to permit urls with authentication of the form of user:pass@hostname/path to be correctly authenticated which should fix some of the issues described in earlier posts. The patch has now been accepted and should be available in the latest ffmpeg via svn.
Phil
ffmpeg in last 1.24.0
Wow this is great news,
I am quite busy at the moment, but i'll give it a try asap.
I am quite busy at the moment, but i'll give it a try asap.
Gentlemen, forgive me for being new to the ZoneMinder (i.e. asking stupid questions), but how do I exactly use this in an already compiled version, such as the one used in Ubuntu (from reps)?
I have a camera with an mjpegb (yuvj422p) stream that I can view with ffmpeg/ffplay. Since using mjpeg gives me twice as good fps than using a static jpg path, I'd like to give gertjan's script a try. Thank you for not hitting me with a brick here
I have a camera with an mjpegb (yuvj422p) stream that I can view with ffmpeg/ffplay. Since using mjpeg gives me twice as good fps than using a static jpg path, I'd like to give gertjan's script a try. Thank you for not hitting me with a brick here