Can i live view my Hikvision on Facebook?

ViciousClone

Expert Member
Joined
Apr 26, 2012
Messages
4,203
Hi guys and gals,

So i have a friend that has a hikvision analog system that's connected to the net(can view the system on the phone and where ever you are)

But he would like to stream it on Facebook ?i tried searching on google but cant find anything...Thought some of you might have tried this.

So he trains people and has this system in place. Said i would check if he can do this on Facebook. He want to use Facebook or an app that streams to Facebook while they train..

Thanks in advance all
 

RoganDawes

Expert Member
Joined
Apr 18, 2007
Messages
1,259
I guess the Hikvision camera is streaming H264, so you could probably use a gstreamer pipeline to receive that, and make it available as a local V4L2 device (on Linux). This repo seems to have the basics nailed down: https://github.com/bluezio/ipwebcam-gst

Once you have the hikvision stream available as a local camera, you should be able to use the Facebook web app (I've never done any live streaming with FB, so am assuming you can do this via the web app) to do your live stream, just choose the right "camera".
 

RoganDawes

Expert Member
Joined
Apr 18, 2007
Messages
1,259
The main takeaway from the abovementioned repo is to use v4l2loopback to make the remote camera available as a local v4l2 device.
 

RoganDawes

Expert Member
Joined
Apr 18, 2007
Messages
1,259
Well, there may well be an easier way, but tbh, that sounds fairly easy to me!

Are you a windows user? Or is your friend a Windows user, should I ask?

This indicates that it may actually be even simpler than I suggested:

http://sixfab.com/tutorial-4-raspbe...ive-video-streamer-with-sixfab-3glte-shields/

Instead of using Raspivid to source the video stream, use gstreamer to connect to the NVR. I'm fairly sure that there is an equivalent command set in gstreamer to the ffmpeg command to post to FB, or alternatively, perhaps ffmpeg can get the stream directly from the NVR and do the necessary conversions to make it suitable for posting to FB in a single command.

From this: https://stackoverflow.com/questions/38079601/gstreamer-for-facebook-live

a command similar to the following should work:

gst-launch-1.0 flvmux name=mux streamable=true ! rtmpsink location="<rtmp_url_for_fblive>" videotestsrc is-live=true ! "video/x-raw,width=1280,height=720,framerate=30/1" ! identity sync=true ! x264enc bitrate=2500 key-int-max=60 ! video/x-h264,profile=high ! h264parse ! queue ! mux. audiotestsrc is-live=true ! audio/x-raw,rate=44100,channels=2 ! identity sync=true ! voaacenc bitrate=128000 ! queue ! mux.

I guess you'd change "videotestsrc" to the parameters necessary to access the stream from the NVR.
 

ViciousClone

Expert Member
Joined
Apr 26, 2012
Messages
4,203
Well, there may well be an easier way, but tbh, that sounds fairly easy to me!

Are you a windows user? Or is your friend a Windows user, should I ask?

This indicates that it may actually be even simpler than I suggested:

http://sixfab.com/tutorial-4-raspbe...ive-video-streamer-with-sixfab-3glte-shields/

Instead of using Raspivid to source the video stream, use gstreamer to connect to the NVR. I'm fairly sure that there is an equivalent command set in gstreamer to the ffmpeg command to post to FB, or alternatively, perhaps ffmpeg can get the stream directly from the NVR and do the necessary conversions to make it suitable for posting to FB in a single command.

From this: https://stackoverflow.com/questions/38079601/gstreamer-for-facebook-live

a command similar to the following should work:

gst-launch-1.0 flvmux name=mux streamable=true ! rtmpsink location="<rtmp_url_for_fblive>" videotestsrc is-live=true ! "video/x-raw,width=1280,height=720,framerate=30/1" ! identity sync=true ! x264enc bitrate=2500 key-int-max=60 ! video/x-h264,profile=high ! h264parse ! queue ! mux. audiotestsrc is-live=true ! audio/x-raw,rate=44100,channels=2 ! identity sync=true ! voaacenc bitrate=128000 ! queue ! mux.

I guess you'd change "videotestsrc" to the parameters necessary to access the stream from the NVR.

Yes windows,

im going to get a dvr kit to test the scenario
 

RoganDawes

Expert Member
Joined
Apr 18, 2007
Messages
1,259
You may be able to run it on a Raspberry Pi, for example? I'd only expect that to work if you can simply "repackage" the H264 stream, rather than having to transcode it entirely, though!
 

ViciousClone

Expert Member
Joined
Apr 26, 2012
Messages
4,203
You may also be able to build something on top of this: https://github.com/131/h264-live-player

Not 100% sure of the complexities of accessing both Facebook and the NVR, you may have to circumvent Same Origin Policies to do this.

Hoped for a easy plug and play option, seems not.So i'm thinking of just getting a lekker R1000-1500 webcam for him,with a 15m USB cable mount it at a good spot.That will be the easiest option i think?
 

RoganDawes

Expert Member
Joined
Apr 18, 2007
Messages
1,259
So this might be interesting, depending on how much time you have to get the specific IP forwarder:

https://blog.danman.eu/new-version-of-lenkeng-hdmi-over-ip-extender-lkv373a/

Short version is that you can hook up the HDMI sender to the network, and then receive the stream using ffmpeg:

ffmpeg -i udp://239.255.42.42:5004 -vcodec copy -codec:a aac -b:a 128k -f flv rtmp://a.rtmp.youtube.com/live2/<stream key>

Which will stream the output to youtube. I'm pretty sure you can do the same thing with the appropriate output to stream to facebook Live too.

Also, I discovered that gstreamer runs on Windows, so you could possibly use one of more of the techniques above on a Windows client too.
 
Top