1

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.

Questions:

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?

1

From the suggestion of this answer I'll also recommend an external server with a reverse proxy and ffmpeg or vlc in order to be able to use nginx powerful caching methods.

EDIT: You didn't mention that there will be lot of device streaming to lot of users. But, in fact nginx support hls and rtmp this could be a starting point. Always start minimal. If you're not familiar with NGiNX I'll advise you to start play with it, or find someone with that skills. There's many resources and examples available everywhere. Github as a lot of them. here & here for example. Your question isn't so detailed so, if you have a draft or something please add it to the question and I'll edit my answer.

  • I am completely a noobie in all these server-client stuff, and I didnt understand a thing. Are you saying that this would help me to implement what I have mentioned? Like I said, I will have many mumber of remote devices and each of them will be streaming live videos to the 'one' server, from where the user can access the streams. Its kinda cloud backup, with live feed. – HardCoder Aug 22 '17 at 9:39
  • You didn't mention that there will be lot of device streaming to lot of users. I edited my post – Maxime S. Aug 22 '17 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.