Hey I wanted to stream rpi cam live footage to a webpage hosted on django server running onther Pc.Any suggestions on how to do it.Thanks.
motion to stream Raspberry Pi camera on an RTSP/HTML protocol over network. Receives streams on the PC and then follow your idea.
sudo apt-get install motion
Open up the web page on your PC:
You can change/set stream port, security, motion detection, etc option on
I've been using UV4L at work to get streaming video going pretty easily. I'm sure you can code a page to get the MJPEG stream from it fairly easily, but UV4L has it's own built in page to do it. If you also need audio, using the built-in WebRTC would fit the bill. It uses standard WebRTC protocols, so building your own page for that also shouldn't be too difficult.
UV4L was originally conceived as a modular collection of Video4Linux2-compliant, cross-platform, user space drivers for real or virtual video input and output devices (with absolutely no external difference from kernel drivers).
FYI, I'm not affiliated with UV4L in any way.
Using Flask I was able to do this using OpenCV library. Flask was a lighter framework than Django that's why I used it, but you can look at my code and make it work on Django also. Another way to do it is with an IP cam, in OpenCV you can pass the IP cam URL to the videocapture area it's pretty straight forward. I hope this helps.
import cv2 URL = 'rtsp://admin:345234@yoururlhere/h264?ch=1&subtype=0' cam = cv2.VideoCapture(URL) while True: ret, frame = cam.read() cv2.imshow("Cam",frame) if cv2.waitKey(1) & 0xFF == ord('q'): break cam.release() cv2.destroyAllWindows()
For more info on how to do it on Flask https://github.com/DanielsKraus/SnowPlow-Bot-Flask