Saturday, March 9, 2013

IPC-HDB3200 and Zoneminder Working

This is how I successfully got the Dahua HDB3200 1080p IP Camera working in Zoneminder with H264. The camera is also known as ESC-HDB3200, IPC-HDB3200, DH-HDB3200. I have this camera working in Full HD 1920x1080 resolution in Zoneminder, you may need to increase your shmget, shmall to help with size of the frames. You can google that part for Zoneminder, but the steps below have worked for me twice with 2 different servers running Ubuntu Server 12.04, 1 machine was a fresh install and the other already had zoneminder and ffmpeg installed but the HDB3200 was not working.

Step 1) Login to linux server, run sudo su.

Step 2) run   I)sudo apt-get install checkinstall
                  II) sudo apt-get install git
        III)Install YASM 1.2(This avoids the error talked about in Step 3(pink text strikedout):

 wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz

 tar xvzf yasm-1.2.0.tar.gz

 cd yasm-1.2.0

 ./configure

 make && make install

 cd ..

Step 3) Follow the steps here to install H264 and FFMPEG.(If this is your blog, please let me know if I can copy paste your instructions on my page and give credits to you in the footer.) Follow the steps on that blog link under the title: "Compiling FFmpeg on Ubuntu" Note: I did not have the folder "/home/user/code", so I ran the commands from the present working directory. So after  cd's to the folder I did cd .. instead of cd /home/user/code.

[I received one error regard a switch --disable-asm or something along those lines, I just re-ran the command with the switch it was promting(--disable-asm or something like that, READ the error and correct my switch.)]

Now on my clean install I received no other errors except the one listed above, which was fixed with the correct switch. However on my production server I did receive an error near the end but the camera worked in zoneminder regardless!!!

Step 4) You followed the instructions above, zoneminder is installed(you should know how to do that), under images in options the path for ffmpeg is added(/usr/bin/ffmpeg) and ffmpeg is checked off as available.
Now reboot the server, shutdown -r now

Step 5) Add the camera to zoneminder:
          i) Create a new monitor and choose source as ffmpeg
         ii) Click on source tab,
add rtsp://admin:admin@192.168.1.100:554/cam/realmonitor?channel=1&subtype=0?tcp to the source(change your IP as neccessary on your network, and admin admin to your  username and password.
         iii) Colours is 24 bit, Width is 1920, Height is 1080, Click save and it should now work. Please note if you want to use the Sub stream change the subtype from 0 to 1.
       

This should work with Dahua IPC-HFW-3200C and many different IP cameras that support RTSP, most problems with RTSP not working can be resolved by using FFMPEG with the RTSP url and H264.


***I know you don't need to include sudo if you already started with sudo su, however I assume some people may miss this step and it will do no harm. I take NO responsibility for errors, loss or any result due to you following my instructions, I had a hard time getting it to work and once I figured it out I thought I would help other people out.

10 comments:

  1. Thank you, this worked perfectly with an IPC-HDB3200CN

    ReplyDelete
    Replies
    1. Glad I helped, I was going crazy trying to get it to work. Once I figured it out I posted to help others.

      Cheers.

      Delete
  2. How many of these 1080p cameras have you tried at once? I bought 10 of them and really want 16 for my end setup. I know they hdd pigs but that's not a problem with 3TB drives being so cheap. I wonder how many quadceore cpus I will need in order to process those fat streams and whether or not zoneminder will even take advantage of huge cpu and RAM resources if I make them available. Thanks in advance for any insight.

    ReplyDelete
    Replies
    1. First of all make sure to use H264 to cut down on bandwidth. I have used 3 1080P plus 3 non HD IP Cameras with normal usage on Ubuntu running on dual core 2.9GHz CPU with 2GB RAM.

      My guess would be using a Core i7(Quad) with 4GB of RAM should be enough or you can buy a desktop server from your local classified site/papers. These desktop servers are the same size as a normal computer but have 2 Xeon Quad Core CPU's.

      On a side note, I noticed that my CPU usage is always less on laptops than desktops.

      Delete
  3. Has anyone tried this with a full 16 cameras.

    ReplyDelete
  4. I have not, but i think you will need 2 quad cpu's and possibly keep a low frame rate(like 5fps or so).

    ReplyDelete
  5. Thanks! It's work with ipc-hfw3200sp-0360b on zoneminder 1.25

    ReplyDelete
  6. Thanks! I had a problem where 1/2 to 3/4 of the video stream was smeared for a few frames every few minutes (or seconds) which created a recordable event in ZM and filled up my hard drive. I found out this is a problem with ffmped using UDP on the RTSP stream. The workaround is to append "?tcp" to the source stream in ZM to force TCP (like your example) but this did not work for me -- the stream was not recognized and I had a blank picture. You can use the command line option "-rtsp_transport tcp" with ffmpeg (and ffplay) but there is no way to add this into Zoneminder which makes library calls to ffmpeg.(You can check whether UDP or TCP by using tcpdump or lsof -i). The solution for me was to edit libavformat/rtsp.c in the ffmpeg source and around line 1770 after int lower_transport is declared and initialized add this:
    lower_transport = 1;
    which forces TCP in the RTSP stream. Then recompile/reinstall ffmpeg (which also recreates the libs needed by ZM), then recompile/reinstall Zoneminder.

    Matt

    ReplyDelete
  7. My above comment was using ffmpeg version 2.1.git and Zoneminder version 1.26.5.

    Matt

    ReplyDelete

Thanks for your input.

PiKVM to NVR

  Trying to connect to your IP Camera Network Video Recorder (NVR) via your PiKVM and it’s not working? No video from the NVR on...