User Tools

Site Tools


solutions:video_stream_using_rpi_as_proxy

This is an old revision of the document!


Intro

Nowadays, IP camera's manufacturers does not provide unauthorized access to video stream due to security reasons. To get video stream to WebHMI it should be without login/password to access.

The solution, is the shim web server in LAN, which will transcode H.264 to MJPEG. (e.g. Raspberry Pi)

Devices prerequisites

Any IP camera, that can show stream using rstp: or http: protocol. By default, cgi should be enabled manually in settings.
Hikvision: Configuration, Network, Advanced Settings, Enable Hikvision-CGI. Then create a cgi user. Dahua: Configuration, Integration Protocol, Enable CGI. Use web login user.

Tested devices list:

Dahua DH-IPC-K22

cgi-link
http://login:password@ip-camera:80/cgi-bin/mjpg/video.cgi?channel=1&subtype=1

Hikvision DS-2CD2423G0-IW

cgi-link
http://login:password@ip-camera:80/Streaming/channels/102/httpPreview

VLC transcode

  • WebHMI with IP 192.168.1.1
  • IP Camera with IP 192.168.1.2
  • Raspberry Pi with IP 192.168.1.3

It can be done with Windows machine or Linux, e.g. Rapsbian on Raspberry Pi. Let's consider using Rapsberry Pi 3B+ powered Raspbian 10.

To do this, VLC player is preinstalled with Rapsbian. To start with, login to IP-camera and check the settings, if cgi enabled and test access via link using browser. To test if it works, copy following link to terminal and run with -vvv argument to show the maximum verbosity.

test_stream
cvlc -vvv rtsp://student:Hikvision@192.168.1.58:554/Streaming/Channels/102
test_transcode_stream
cvlc -vvv -Idummy rtsp://student:Hikvision@192.168.1.2:554/Streaming/Channels/102  --sout "#transcode{vcodec=MJPG}:standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=192.168.1.3:8888/}"

where

  • rtsp:student:Hikvision@192.168.1.2:554 - login and password with IP camera' IP, using RSTP protocol (through 554 port) * dst=192.168.1.3:8888/ is the Raspberry Pi IP with custom port, e.g. 8888. The output should not have warning and unresolved errors such as no codecs finded Command to output and argument explanations === Dahua === <code bash> #full crop cvlc -Idummy http://admin:admin@192.168.1.101/cgi-bin/mjpg/video.cgi?channel=1&subtype=1 –sout “#transcode{vcodec=MJPG}:standard{access=http{mime=multipart/x-mixed-replace;boundary=–7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8888/}” cvlc -Idummy rtsp:admin:admin@192.168.1.101/cgi-bin/mjpg/video.cgi?channel=1&subtype=1 –sout “#transcode{vcodec=MJPG}:standard{access=http{mime=multipart/x-mixed-replace;boundary=–7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8888/}”

#width crop cvlc -Idummy http://admin:admin@192.168.1.101/cgi-bin/mjpg/video.cgi?channel=1&subtype=1 –sout “#transcode{vcodec=MJPG,vfilter=canvas{width=640,height=480}}:standard{access=http{mime=multipart/x-mixed-replace;boundary=–7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8888/}” cvlc -Idummy rtsp:admin:admin@192.168.1.101/cgi-bin/mjpg/video.cgi?channel=1&subtype=1 –sout “#transcode{vcodec=MJPG,vfilter=canvas{width=640,height=480}}:standard{access=http{mime=multipart/x-mixed-replace;boundary=–7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8888/}” </code> === Hikvision === <code bash> #full cvlc -Idummy rtsp:student:Hikvision@192.168.1.58:554/Streaming/Channels/102 –sout “#transcode{vcodec=MJPG}:standard{access=http{mime=multipart/x-mixed-replace;boundary=–7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8888/}” cvlc -Idummy http://student:Hikvision@192.168.1.58:80/Streaming/channels/102/httpPreview –sout “#transcode{vcodec=MJPG}:standard{access=http{mime=multipart/x-mixed-replace;boundary=–7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8888/}”

#width crop cvlc -Idummy rtsp:student:Hikvision@192.168.1.58:554/Streaming/Channels/102 –sout “#transcode{vcodec=MJPG,vfilter=canvas{width=640,height=480}}:standard{access=http{mime=multipart/x-mixed-replace;boundary=–7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8888/}” cvlc -Idummy http://student:Hikvision@192.168.1.58:80/Streaming/channels/102/httpPreview –sout “#transcode{vcodec=MJPG,vfilter=canvas{width=640,height=480}}:standard{access=http{mime=multipart/x-mixed-replace;boundary=–7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8888/}” </code>

solutions/video_stream_using_rpi_as_proxy.1627635823.txt.gz · Last modified: 2021/07/30 09:03 by atolstov

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki