Connecting zoneminder to Swann DVR8-3425 Media Port

A place for discussion of topics that are not specific to ZoneMinder. This could include Linux, Video4Linux, CCTV cameras or any other topic.
Post Reply
sparklee
Posts: 7
Joined: Sun Jun 13, 2021 7:23 pm

Connecting zoneminder to Swann DVR8-3425 Media Port

Post by sparklee » Wed Jun 16, 2021 12:41 pm

Hi all-- hoping someone can point me in the right direction.. I think I am close but seems to stuck. I am new to Linux and came across zoneMinder and it mentioned it can connect to most DVRs and IP cams. Well I have an older swann DVR8-3425 and it doesn't have an rtsp feed (at least I don't think so). I use tinyCam pro on my mobile phone and it can access my dvr and view all the cameras. Not sure how this app is able to view the feed but can't do it with zoneminder.

So I came across another post where they used a plugin (zmodopipe) and that looked promising. So tried to set that up but think I missed something somewhere and hoping you guys can tell me where I went wrong.

zoneMinder is up and running...The setup went smooth. I downloaded and unzip the zmodopipe and set that up. I created the file ffserver2.conf and added the information below. Then I added the bash script. This is where I got stuck. I can't figure out how to call this script. When I try to run "./dvr_connect" I get "./dvr_connect.sh: line 1: spark@ManCave:~$: command not found"

During my setup, I don't recall creating anything that mentioned "dvr_connect" so maybe something there is what I am missing. The post I was trying to follow is mentioned is viewtopic.php?f=12&t=27142&p=105374&hilit=swann#p105374. Can you guys help me out here?

Code: Select all

Port 8090

#RTSPPort 8554
#HTTPPort 8554

BindAddress 0.0.0.0

MaxHTTPConnections 2000

MaxClients 1000

MaxBandwidth 9000

CustomLog -


NoDaemon


<Feed feed1.ffm>

File /tmp/feed1.ffm
FileMaxSize 200K

ACL allow 127.0.0.1

</Feed>

<Stream test.mjpg>
Feed feed1.ffm
Format mpjpeg
VideoFrameRate 10
VideoSize 320x240
VideoBufferSize 40
VideoGopSize 12
VideoBitRate 1200
AVOptionVideo flags +global_header
NoAudio
</Stream>
bash script

Code: Select all

spark@ManCave:~$ cat ./dvr_connect 
#!/bin/bash

CODEC_OPTS=''

./zmodopipe -s 192.168.86.4 -p 18004 -c 1 -u TESTER-a 1234-m 1 > /dev/null 2>&1 &

ffserver -f /etc/ffserver2.conf > /tmp/ffserver.log 2>&1 &

ffmpeg -i /tmp/zmodo0 $CODEC_OPTS http://localhost:8090/feed1.ffm > /tmp/zmodoffmpeg1 2>&1 &

mikb
Posts: 501
Joined: Mon Mar 25, 2013 12:34 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by mikb » Wed Jun 16, 2021 2:39 pm

When I try to run "./dvr_connect" I get "./dvr_connect.sh: line 1: spark@ManCave:~$: command not found"
Line 1 is "#!/bin/bash"

Do you *have* bash installed at /bin/bash ? (If not, that would explain a lot!)

What does "echo $SHELL" tell you about your current shell?

Do you have "ffserver, ffmpeg" in your PATH (e.g. baldly typing "ffmpeg --help" or "ffserver --help" gets you useful output?

Is "zmodopipe" in the CURRENT directory (you are executing it as "./zmodopipe" so specifiying to be *here* wherever HERE is :)

sparklee
Posts: 7
Joined: Sun Jun 13, 2021 7:23 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by sparklee » Wed Jun 16, 2021 4:17 pm

Thanks you for your response...
Running "echo $SHELL" results is /bin/bash

When I ran the command for ffmpeg and ffserver it presented lots of information. Not sure what to do with that.

zmodopipe is in my HOME directory

mikb
Posts: 501
Joined: Mon Mar 25, 2013 12:34 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by mikb » Thu Jun 17, 2021 2:14 pm

> Running "echo $SHELL" results is /bin/bash

So you clearly *have* bash in the place your script indicates. Which makes me think that the script is lying about the error in line 1 -- this can happen sometimes, and it's not helpful when debugging. :)

ffmpeg and ffserver returning lots of stuff -- good, that means the commands are in your path, Otherwise you'd get "ffmpeg: Command not found".

"zmodopipe is in your $HOME directory", but where are you when you run this dvr_connect script? *That* directory is where it will look for "zmodopipe" as you're looking in "./zmodopipe" (that's here, wherever HERE is). If you are in your $HOME directory, then all good.

Try running dvr-connect as "bash -x ./dvr_connect" to see if it becomes any clearer which line it *really* chokes on, it should add lines to the screen output just before it executes each line.

sparklee
Posts: 7
Joined: Sun Jun 13, 2021 7:23 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by sparklee » Thu Jun 17, 2021 2:28 pm

So I am lost...Because I was just using this script from another post, I am actually not sure what this portion does. ":~$ cat ./dvr_connect" Is this suppose to be referencing another script somewhere? Running "bash -x ./dvr_connect" Results in "No such file or directory" which leads me to think I am missing a peace of the puzzle.

mikb
Posts: 501
Joined: Mon Mar 25, 2013 12:34 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by mikb » Fri Jun 18, 2021 3:26 pm

Code: Select all

spark@ManCave:~$ cat ./dvr_connect 
#!/bin/bash
I'm hoping this is not appearing as a daft answer, but can I just check that it's not something so obvious that I didn't ask ;)

You have a file you have created, called "dvr_connect", which you have made executable (it is a script, so "chmod 700 dvr_connect"

... into which you have pasted everything starting with "#!/bin/bash" as the first line.

And that you have not included any part of the phrase "spark@ManCave:~$ cat ./dvr_connect" inside that file? If so, delete that line and try again.

I just got this feeling that you may have accidentally included the other user's shell prompt, and the command they ran to DUMP the contents of the file for exposition purposes, into the file.

I got worried when I read "I am actually not sure what this portion does ..." as it's not any part of the script.

It's "your username" @ "your machine name", and is printed by the bash command shell.
As is "~" is a short cut for "and you are in your home directory".
And "$" is the shell prompt.
"cat" is either a command or a shell builtin to dump contents of a file, typed by the original poster,
and "./dvr_connect" is the file the original poster was dumping out.

What followed was the content of "./dvr_connect" script.

It's so obvious (to me, to the OP) as a regular Linux user, that it has taken this long for me to realise what might be the problem and question it, so don't feel daft! :)

mikb
Posts: 501
Joined: Mon Mar 25, 2013 12:34 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by mikb » Fri Jun 18, 2021 3:38 pm

sparklee wrote:
Wed Jun 16, 2021 12:41 pm

Code: Select all

#!/bin/bash

CODEC_OPTS=''

./zmodopipe -s 192.168.86.4 -p 18004 -c 1 -u TESTER-a 1234-m 1 > /dev/null 2>&1 &

ffserver -f /etc/ffserver2.conf > /tmp/ffserver.log 2>&1 &

ffmpeg -i /tmp/zmodo0 $CODEC_OPTS http://localhost:8090/feed1.ffm > /tmp/zmodoffmpeg1 2>&1 &
Further, you have to be REALLY careful about cut-and-paste/retyping/editing stuff to not introduce tiny errors (these will bite you next) ;)

Original :-

Code: Select all

./zmodopipe -s 192.168.1.3 -p 18004 -c 1 -u user -a pass -m 1 > /dev/null 2>&1 &
Yours :-

Code: Select all

./zmodopipe -s 192.168.86.4 -p 18004 -c 1 -u TESTER-a 1234-m 1 > /dev/null 2>&1 &
You have lightly mangled the -u -a and -m section (now, that could be in re-posting it here to redact user/password, or it could be like that in the file). Make sure you have spaces between the -u, -a, -m commands and their arguments.

As written, your username is "TESTER-a", there's a spare "1234-m" (what?) and a "1" (what?) with no password (-a) -- because two spaces have been deleted! :)

sparklee
Posts: 7
Joined: Sun Jun 13, 2021 7:23 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by sparklee » Fri Jun 18, 2021 6:53 pm

Awww mann,... Made the changes and nolonger getting the errors. Still no streams in zoneminder. Must be missing something else... Time to give this project up and just get a new dvr with rtsp streams...Been messing with this for over a month. Thank you for your detail response and knowlege. Have been really helpful.

mikb
Posts: 501
Joined: Mon Mar 25, 2013 12:34 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by mikb » Sat Jun 19, 2021 2:33 pm

You may well have some error messages that you can't see. I don't know anything about zmodopipe, but :-

./zmodopipe -s 192.168.86.4 -p 18004 -c 1 -u TESTER-a 1234-m 1 > /dev/null 2>&1 &

ffserver -f /etc/ffserver2.conf > /tmp/ffserver.log 2>&1 &

The first command may well spit out some errors, but all output (1, stdout) from it is being discarded (> /dev/null) as are errors (2, stderr) (2>&1)

The second command there is sending any output to "/tmp/ffserver.log", and any errors into the same file.

You could try looking in "/tmp/ffserver.log" for clues. Also, you could try changing the zmodopipe line to :-

./zmodopipe -s 192.168.86.4 -p 18004 -c 1 -u TESTER -a 1234 -m 1 > /tmp/zmodoipe.log 2>&1 &

and catch any output from that.

sparklee
Posts: 7
Joined: Sun Jun 13, 2021 7:23 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by sparklee » Sat Jun 19, 2021 6:07 pm

When I used your recommendation the only thing appeared in the log was the number "1"

In the ffserver.log, this is what I got. Have no clue what any of means.

Code: Select all

ffserver version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
/etc/ffserver2.conf:1: Port option is deprecated. Use HTTPPort instead.
/etc/ffserver2.conf:6: BindAddress option is deprecated. Use HTTPBindAddress instead.
/etc/ffserver2.conf:17: NoDaemon option has no effect. You should remove it.
/etc/ffserver2.conf:42: Setting default value for video bit rate tolerance = 300000. Use NoDefaults to disable it.
/etc/ffserver2.conf:42: Setting default value for video rate control equation = tex^qComp. Use NoDefaults to disable it.
/etc/ffserver2.conf:42: Setting default value for video max rate = 2400000. Use NoDefaults to disable it.
/etc/ffserver2.conf:63: Setting default value for video bit rate tolerance = 300000. Use NoDefaults to disable it.
/etc/ffserver2.conf:63: Setting default value for video rate control equation = tex^qComp. Use NoDefaults to disable it.
/etc/ffserver2.conf:63: Setting default value for video max rate = 2400000. Use NoDefaults to disable it.
/etc/ffserver2.conf:84: Setting default value for video bit rate tolerance = 300000. Use NoDefaults to disable it.
/etc/ffserver2.conf:84: Setting default value for video rate control equation = tex^qComp. Use NoDefaults to disable it.
/etc/ffserver2.conf:84: Setting default value for video max rate = 2400000. Use NoDefaults to disable it.
Sat Jun 19 14:01:42 2021 [ffm @ 0x55d2e9c1a6e0]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Sat Jun 19 14:01:42 2021 [ffm @ 0x55d2e9c2ed40]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Sat Jun 19 14:01:42 2021 [ffm @ 0x55d2e9c70a40]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
bind(port 8090): Address already in use
Sat Jun 19 14:01:42 2021 Could not start server

mikb
Posts: 501
Joined: Mon Mar 25, 2013 12:34 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by mikb » Sun Jun 20, 2021 4:31 pm

I assume you mean "1" was the output from zmodopipe. That's not so useful then, I was hoping for more :)

The ffserver log shows ffserver didn't start. I'm guessing that use of ffserver in this endeavour is NOT optional, which is why it's there.

Code: Select all

/etc/ffserver2.conf:1: Port option is deprecated. Use HTTPPort instead.
/etc/ffserver2.conf:6: BindAddress option is deprecated. Use HTTPBindAddress instead.
/etc/ffserver2.conf:17: NoDaemon option has no effect. You should remove it.
Your options in the ffserver config file are out of date for the version of ffserver you are using, however it seems to understand you, it's just telling you to get up to date with your instructions. This happens. Everything seems to end up deprecated (please use the new thing!) :)

The killer line among the gentle whinging and informational stuff is

Code: Select all

bind(port 8090): Address already in use
Sat Jun 19 14:01:42 2021 Could not start server
You already have something running on port 8090 of your PC. You're asking ffserver to create a "listener" (a server) on port 8090 of your machine for things to connect to (presumably zoneminder), yet something is already using it. My guess would be that you do already have something using port 8090, it might even be an old ffserver hanging about from experimenting with things ... :(

To see if this is the case, try "netstat -n -l"

Example :-

Code: Select all

netstat -n -l

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      
If you see an ....:8090 in that list, you have something already occupying that port ...

Here, you can see an SSH server (Port 22) and an SMTP server (Port 25) among others ...

sparklee
Posts: 7
Joined: Sun Jun 13, 2021 7:23 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by sparklee » Mon Jun 21, 2021 10:38 am

Thank you so much... I changed the port, went back and made sure I had the correct spaces in the scripts. I can finally see call my cameras in ZM. :D Thank you for not giving up on the post when I actually was close to doing so. Learnt so much in short time with your responses.

mikb
Posts: 501
Joined: Mon Mar 25, 2013 12:34 pm

Re: Connecting zoneminder to Swann DVR8-3425 Media Port

Post by mikb » Mon Jun 21, 2021 3:02 pm

sparklee wrote:
Mon Jun 21, 2021 10:38 am
Thank you so much... I changed the port, went back and made sure I had the correct spaces in the scripts. I can finally see call my cameras in ZM. :D Thank you for not giving up on the post when I actually was close to doing so. Learnt so much in short time with your responses.
Excellent news! Just be aware that it may happen again if the port you moved to gets something stuck on it, but at least you know where to look now! :)

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests