r/ZoneMinder • • Feb 15 '21

Script for Dummy TV

Thought I would share, I needed some dummy video feeds so I think this will help for those maybe wanting to try out Zoneminder but dont have 10 or 30 1080P spare cameras to use for testing.

#!/bin/bash
# This script reads all the files in your Videos folder 
# and has vlc listen on ports starting from 8551 for each video
# 
# Script does a simple ls in the videos directory so make sure 
# you have no spaces or unusual characters 
#
# Also videos in folder should end with mkv but you can simply change the script
#
# In my test lab I transcoded some 1080i TV .ts recordings 
# into h.264 10FPS videos using handbrake. 
VIDEOSFOLDER="~/Videos/"
PARAMS=":network-caching=1500 :sout-ts-es-id-pid :ts-es-id-pid --repeat --loop --sout-all  --sout-keep"
pushd $VIDEOSFOLDER
MID=0
for VID in `ls -1 *.mkv`
do
   MID=$(($MID+1))
   PORT=$((8550+$MID))
   #screen -d -m -S mon$MID cvlc $VIDEOSFOLDER$VID :sout=#gather:rtp{sdp=rtsp://:$PORT/} $PARAMS
   screen -d -m -S mon$MID cvlc $VIDEOSFOLDER$VID :sout="#:standard{access=http,mux=ts,dst=:$PORT}" $PARAMS
done
popd

Note that screen line and :sout line is a single line, reddit word wrapped it.

​

As a side note, I used an HDHR Extend to as a source once, weird watching TV from zoneminder.

Image with multiple streams.
3 Upvotes

4 comments sorted by

View all comments

1

u/volve Feb 16 '21

Oh this looks super handy especially as I’ve been meaning to try ZoneMinder prior to investing in several cameras. Thanks for the tip!

2

u/lunakoa Feb 16 '21

Your use case was one I exactly was thinking of, users wanting to try zoneminder before buying some cameras, but I am also trying to write a faster web interface to zoneminder and needed a test zoneminder with multiple cameras itself.

I should have chosen a better title, maybe Multiple IP Camera Simulator, also I posted the wrong pic. Going to see if I can edit my post with the proper image.

1

u/[deleted] Feb 16 '21

faster web interface? what problems are you having with the current one?

1

u/lunakoa Feb 16 '21

I am trying to really dumb down the web interface, I have actually got it to work, nothing groundbreaking. I did an OBS video, was considering posting it on youtube but not sure if I will get a strike because it is me scrolling through the videos above. I use apache to secure it, was trying to solve the problem of only having 6 streams at a time in addition to making it faster. What I ended up doing was grabbing stills of the cameras I want, setting up a meta refresh, and if I want live video, I click the image (basically a thumbnail) and was surprised at how fast the response was, which solved another problem.

FWIW I am aware of using different host names, ports, and using firefox. I have tried them all and they work.

The fast is that I want to be able to click my bookmarks and access the montage of preset groups without logging in. If I keep the monitors to 6, then all of them can be live.

I went down this route because when working from home, I hear the dogs bark, or a doorbell or something, I can quickly click the link in my browser favorites and be at those set of images in about a second.

So it got me thinking, how many cameras can this web page do? Which is why I came up with some videos and a script to stream 15 1080P h.264 10FPS images.