Live streaming video using a raspberry pi, over a 4G network which is accessible from anywhere around the world. In this application raspberry pi will be the client to a webserver, and user should be able to access the stream once he has access to the server.
Already tried the streaming using port forwarding and ddns, but thats not an apt solution as there would be many number of remote devices.
Thinking of saving the video stream to a fixed size file, and then uploading the file such that an upload happens when the media file is 10MB(say). And this happens continuously.
Or else, converting the video stream to raw bytes and then sending these to the server, where the raw bytes can be converted back to video format.
Already tried with OpenCV and Python, captured image frames as raws bytes, which was then then posted to the server over HTTP. At the server side the raw bytes were converted back to image frames and displayed one after other continuously. So that gives a live stream.
Raw bytes corresponding to each frame was punctuated using a specific character, "*" in my case. This helps to identify each frame (raw bytes) at the server side.
The solution works, but its a bit lagging and hs lots of breaks.
Is this the correct method for implementing live videos? If yes, how can I make the stream more stable without lags and breaks? If this is not the best method, then what could be the best? Is it possible to use flask framework for this application, with raspberry pi being the client? If not flask, then any other useful technology for this application?