Connecting zoneminder to Swann DVR4-1300 Media Port
Posted: Wed Apr 11, 2018 4:57 pm
I have an old DVR that I want to setup to work with ZoneMinder. Right now I have it setup to send the TV-Out to my PC with a capture card and monitor it thorugh zoneminder like that, but I don't like that every channel is brought on one signal to be treated as a single monitor by zoneminder. I've been slowly upgrading to IPcams, but still have my outdoor cameras wire up through the DVR.
It has a "media port" on 18004 but I don't have any idea what protocol it's using. I've tried to add it with zoneminder with no luck, but I have an application on my tablet called "IPCam Viewer" that views them fine. I tried to contact the author, but of course he didn't respond with any help (thanks, jerk) so how this application is streaming the channels is a mystery to me.
Well, I know a little bit about computer here and there, so I used WireShark to sniff the TCP stream and I got a rough idea of how the streaming works for the DVR. Basically the viewing device sends a "command" to the box consisting of the channel ID and the username, and then the DVR begins sending back an H.264 stream. The command looks something like this...
I don't quite remember which bite was the one to control the channel, but it counts from 0-3 so it's somewhere in the first few bytes that I'm specifying. So then it sends back a H.264 stream ( though I can barely get it to play in anything besides mplayer ).
(Just a snippet)
Now I've obtained this basically by doing...
I thought maybe appending it on each request was needed so I tried...
Thinking it just would send updated packet information to be appended each time, but haven't really been able to get any media player to open it and play it successfully.
So any ideas? I'm going to upgrade to IPcams eventually but just thought it would be fun to figure this out.
It has a "media port" on 18004 but I don't have any idea what protocol it's using. I've tried to add it with zoneminder with no luck, but I have an application on my tablet called "IPCam Viewer" that views them fine. I tried to contact the author, but of course he didn't respond with any help (thanks, jerk) so how this application is streaming the channels is a mystery to me.
Well, I know a little bit about computer here and there, so I used WireShark to sniff the TCP stream and I got a rough idea of how the streaming works for the DVR. Basically the viewing device sends a "command" to the box consisting of the channel ID and the username, and then the DVR begins sending back an H.264 stream. The command looks something like this...
Code: Select all
00000000 00 00 00 40 00 00 00 00 29 00 38 00 61 64 6d 69 |...@....).8.admi|
00000010 6e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |n...............|
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000044
(Just a snippet)
Code: Select all
00000000 00 00 00 14 00 00 00 00 28 00 04 00 03 00 07 00 |........(.......|
00000010 2a 00 04 00 01 00 00 00 00 00 00 84 00 00 00 00 |*...............|
00000020 46 00 48 00 42 30 46 33 33 42 37 33 39 44 45 37 |F.H.B0F33B739DE7|
00000030 36 44 37 39 00 00 00 00 00 00 00 00 00 00 00 00 |6D79............|
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000050 00 00 00 00 56 31 32 30 38 32 37 00 00 00 00 00 |....V120827.....|
00000060 00 00 00 00 00 00 00 00 04 00 00 00 41 00 04 00 |............A...|
00000070 01 00 00 00 c7 00 28 00 00 00 00 00 48 32 36 34 |......(.....H264|
00000080 00 7d 00 00 40 01 f0 00 05 18 00 00 00 00 00 00 |.}..@...........|
00000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000000a0 00 00 11 58 00 00 00 00 63 00 0c 00 00 00 00 00 |...X....c.......|
000000b0 00 00 00 00 00 00 00 00 64 00 40 11 00 00 00 01 |........d.@.....|
000000c0 67 42 e0 14 db 05 07 c4 00 00 00 01 68 ce 30 a4 |gB..........h.0.|
000000d0 80 00 00 00 01 06 e5 01 fa 80 00 00 00 01 65 b8 |..............e.|
000000e0 00 01 f5 f8 2c 50 ae 1f 02 09 17 70 60 00 13 54 |....,P.....p`..T|
000000f0 07 fd 1a 87 cc 8a 68 99 d2 f5 e1 c7 96 fe 27 7f |......h.......'.|
00000100 df 85 48 9c bc 4d fc 1a 8b 05 81 bb e9 92 a0 e9 |..H..M..........|
00000110 63 68 f1 4f de ee 21 53 49 05 f0 47 bc 11 8a 1c |ch.O..!SI..G....|
00000120 80 04 96 d2 63 c6 da 29 ca 18 ee 59 a7 d4 0c 38 |....c..)...Y...8|
00000130 b3 23 35 1f fd 9a 0d 4e ba 92 bc fd fb 12 89 93 |.#5....N........|
00000140 73 2a ab ca e9 4e c7 c6 2e 4f 61 e6 02 0e e2 0d |s*...N...Oa.....|
00000150 36 c9 d1 9d c4 78 77 e7 b5 18 6f df ee 74 0d 29 |6....xw...o..t.)|
00000160 e1 08 5f d4 03 f5 46 c6 2b 47 67 bd 4f 89 16 3e |.._...F.+Gg.O..>|
Code: Select all
cat ipcommand | nc 192.168.1.3 18004 > ipcam_out
Code: Select all
cat ipcommand | nc 192.168.1.3 18004 >> ipcam_out
So any ideas? I'm going to upgrade to IPcams eventually but just thought it would be fun to figure this out.