Page 1 of 1

Re: How to connect Hikvision camera to raspberry pi 3

Posted: Sat Nov 09, 2019 3:10 pm
by fruitoftheloom
duongtam12 wrote:
Sat Nov 09, 2019 3:51 am
Hello

I use HIKVISION camera DS-2CD3625G0-IZS for image processing. But I don't know how to connect it to raspberry pi 3. Anyone can tell me how to connect it?

Thanks

Presumably it is a IP Cam, therefore if it is on the same Network as the Raspberry Pi, software like MotionEyeOS should see the Camera:

https://github.com/ccrisan/motioneyeos/wiki

Re: How to connect Hikvision camera to raspberry pi 3

Posted: Thu Nov 14, 2019 2:36 pm
by Lewis-H
Raspberry PI 3 running OS raspbian
pi@pi-resp:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL"http://www.raspbian.org/"
SUPPORT_URL"http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL"http://www.raspbian.org/RaspbianBugs"
Monitor Full HD with HDMI
You will need your IP Address of your Hikvision DVR and the username & password.
Do make sure that your Hikvision and Raspberry PI are on the same network and you know the IP :D
You will need to install the following softwares (make sure your OS is updated to latest)
omxplayer — which you can install by running sudo apt-get install omxplayer
omxplayer is the video player which uses GPU
Next, lets start configuring the raspberry pi system
sudo raspi-config
As omxplayer is going to use lots of GPU, lets increase the GPU Ram to 256Mb
Advance Option -> Memory Split -> Change the Value to 256 -> Save and Reboot
Optionally, you can keep the system running in CLI Mode. So you don’t burn your CPU and RAM is other unwanted things.
To do so, again open the raspi-config
-> Boot Options -> Desktop / CLI -> Console (Text Console, requiring user to login)
Next, lets make the display always active. by default the display turns off after 10 mins incase of no interaction on the console.
edit the file /etc/kbd/config by using sudo nano /etc/kbd/config
# screen blanking timeout. monitor remains on, but the screen is cleared to
# range: 0-60 min (0==never) kernels I've looked at default to 10 minutes.
# (see linux/drivers/char/console.c)
BLANK_TIME=0
change the value of BLANK_TIME to 0, as shown in the above example.
To start the video you can just write
omxplayer --live --refresh --video_queue 4 --fps 30 --win “0 0 1920 1080” rtsp://<username>:<password>@<ip-hikvision>/h264/ch1/main/av_stream
with the above command you should be able to start your live video from channel 1 camera.
Hope this helps you!
Regards,
Lewis

Re: How to connect Hikvision camera to raspberry pi 3

Posted: Wed Nov 20, 2019 7:47 pm
by cqx931
Hi Lewis,

I tried the command line you provided however I got "File 0 not found" in the command line, do you have any idea why am I getting that? Thanks!

Re: How to connect Hikvision camera to raspberry pi 3

Posted: Wed Apr 15, 2020 3:48 am
by juanfeyero
If you are using python and opencv
You only need to use the following command:
img = cv2.VideoCapture("rtsp://admin:password@ipaddress/Streaming/channels/102")

If you want to access to another channel could be 202, 302, etc.

Re: How to connect Hikvision camera to raspberry pi 3

Posted: Wed Apr 15, 2020 10:32 am
by Heater
juanfeyero wrote:
Wed Apr 15, 2020 3:48 am
If you are using python and opencv
You only need to use the following command:
img = cv2.VideoCapture("rtsp://admin:password@ipaddress/Streaming/channels/102")

If you want to access to another channel could be 202, 302, etc.
This is misleading and/or incorrect.

The OpenCV VideoCapture method only returns a video capture device. It does not actually retrieve any video frames. Should more likely be:

Code: Select all

capture = cv2.VideoCapture("rtsp://admin:password@ipaddress/Streaming/channels/102")
To capture actual frames from the device requires using the read() method of the capture device:

Code: Select all

ret, frame = capture.read()
Likely you want that in a loo to capture all the frames. Of course you then need to write more code to display or do whatever you want to do with the video.

Anyway, isn't the OP here some kind of crypto currency SPAM?