convert ZM/zms output stream to RTSP (for Amazon Alexa)

Add any particular hints or tricks you have found to help with your ZoneMinder experience.
Post Reply
carteriii
Posts: 64
Joined: Sun Oct 28, 2007 3:13 pm

convert ZM/zms output stream to RTSP (for Amazon Alexa)

Post by carteriii » Wed Jul 18, 2018 3:14 pm

I would like to view my ZoneMinder cameras through an Amazon Echo Spot (or Echo Show). This requires providing an H.264 stream with RTSP or RTP protocol. You can find details of Amazon's requirements here: https://developer.amazon.com/docs/smart ... kills.html

There is a fantastic github repo created by another Zoneminder user (https://github.com/goruck/alexa-ip-cam), but that person is using only Axis cameras that directly support RTSP, so that github project isn't really taking a zm output video stream which I believe is simply mjpeg.

On the surface it would seem feasible that some use of ffserver/ffmpeg could take a URL to zm's mjpeg stream (e.g. /cgi-bin/nph-zms?mode=jpeg&monitor=1&user=xxx&pass=xxx) and convert it to RTSP for use by as an Amazon Alexa Smart Home Camera. I do see zms has an "mpeg" mode, but I assume jpeg mode would be better so there aren't two separate conversions happening.

Has anyone done this before, or if you're an ffserver/ffmepg expert, would you please you offer a sample configuration for this? I may be able to fumble my way through some ffserver/ffmpeg options, but I'd appreciate any configuration tips if someone has done this before, particularly to ensure the conversion is only happening when someone is access the RTSP stream.

carteriii
Posts: 64
Joined: Sun Oct 28, 2007 3:13 pm

Re: convert ZM/zms output stream to RTSP (for Amazon Alexa)

Post by carteriii » Thu Jul 19, 2018 9:42 pm

Just a quick update that I've been trying (mostly failing) to get ffserver & ffmpeg to create an RTSP stream of ZM's mjpeg stream. I've been trying to view this with VLC, which only gives me a blank/black screen. Until I can view the feed with VLC, there's no point in doing any of the Alexa-specific work.

I'll keep playing with this, but if someone else here is good with ffserver/ffmpeg, please feel free to suggest an ffserver.conf file and/or ffmpeg command line that works :D

In case someone else also wants to try (hint! hint! please!), this is my starting ffmpeg command in the "Feed". In case it isn't obvious, I've sanitized everything in the ZM URL here so please don't think that part is the problem:

Code: Select all

Launch ffmpeg -i https://mydomain.com/zm/cgi-bin/nph-zms?mode=jpeg&scale=100&maxfps=5&monitor=2&user=user&pass=pass&connkey=xxxxxx&rand=yyyyy
... and these are the two streams I've tried (one h264, and one straight mjpeg), both reading the feed with the ffmpeg command above and starting from the sample in the default conf file:

Code: Select all

<Stream live.h264>
Format rtp
Feed feed1.ffm
VideoCodec libx264
VideoFrameRate 24
VideoBitRate 100
VideoSize 640x480
AVPresetVideo default
AVPresetVideo baseline
AVOptionVideo flags +global_header

# Suppress audio (or you'll get an error)
NoAudio
</Stream>

<Stream live.mjpeg>
Format rtp
Feed feed1.ffm
VideoCodec mjpeg
VideoFrameRate 5
VideoBitRate 100
VideoSize 640x480
AVPresetVideo default
AVPresetVideo baseline
AVOptionVideo flags +global_header

# Suppress audio (or you'll get an error)
NoAudio
</Stream>

mrd
Posts: 245
Joined: Wed Apr 26, 2006 12:39 am
Location: Boston USA

Re: convert ZM/zms output stream to RTSP (for Amazon Alexa)

Post by mrd » Mon Aug 20, 2018 12:29 pm

This may be a very unhelpful reply and I may have missed the entire point of what you are trying to do, but I view my local cameras through their direct streams with Amazon fire tablets using an app called TinyCam Pro. It works very well for me and I don't put any load on the ZM server that way.
MRD

carteriii
Posts: 64
Joined: Sun Oct 28, 2007 3:13 pm

Re: convert ZM/zms output stream to RTSP (for Amazon Alexa)

Post by carteriii » Tue Aug 21, 2018 4:34 am

mrd wrote:
Mon Aug 20, 2018 12:29 pm
This may be a very unhelpful reply and I may have missed the entire point of what you are trying to do
As I said in the first sentence of my first post: "I would like to view my ZoneMinder cameras through an Amazon Echo Spot (or Echo Show)." The part that may be missing from that statement is that this setup will allow me to use a voice command to display the stream on one of those devices.

For what it's worth, I do have the RTSP stream figured out but I simply haven't had time to get back to this and work through the details of the alexa-ip-cam project. I'll post more details once I've had time to work through the rest of what needs to be done.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest