Stream mpeg/h264/avi; whatever you'd like from ZM

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
kristoffer
Posts: 15
Joined: Thu Mar 06, 2014 5:18 pm

Stream mpeg/h264/avi; whatever you'd like from ZM

Post by kristoffer »

Someone directed me to a feature of ZM that i think is cool, streaming video through FFmpeg so that the format can be mpeg, avi or whatever FFmpeg handles. Personally i want to use it to avoid streaming mjpeg since that takes alot of bandwidth.

It didn't work for me though; zms process just crashed. This is my attempt to improve the code to support this feature better.

Documentation:
URL for accessing zms:

Code: Select all

http://x.x.x.x/zm/cgi-bin/nph-zms?mode=mpeg&monitor=3&scale=100&maxfps=6&bitrate=75&format=mpegts/h264
(your url might also begin with)
http://x.x.x.x/cgi-bin/nph-zms?
This url will display Monitor with id 3 in full size with a max FPS of 6. The quality will be 75% and the video will be h264 inside a mpegts container.

Features:
- To choose codec, include it in the URL like "&format=mpegts/h264" for example.
- To choose quality instead of bitrate, include it in the URL like "&bitrate=75" (if bitrate <= 100 it's assumed to be a quality setting)

Note; which format/codec combos that work is pretty much up to what version of FFmpeg you're using. If something doesn't work I've found it really helpful to run...

Code: Select all

LOG_FLUSH=1 LOG_PRINT=1 QUERY_STRING="mode=mpeg&monitor=3&scale=100&bitrate=750000&maxfps=30&format=mpegts/h264" src/zms > /tmp/test.ts
...to get helpful debug-text from FFmpeg.

If you give it a try, please post what combination of FFmpeg version and format/codec that worked for you.

Code is available at: https://github.com/Sune1337/ZoneMinder/tree/zms/ffmpeg
Post Reply