Tomtomgo / raspberry_livestream

Streaming live video from a webcam over RTMP using a Raspberry Pi and Nginx
https://github.com/Tomtomgo/raspberry_livestream
171 stars 40 forks source link

What's the delay? #8

Open michaelgundlach opened 7 years ago

michaelgundlach commented 7 years ago

Hey, thanks for writing this up! Your README and your "sharing is caring" comment are so friendly I was encouraged to bug you for input :)

I'd like to stream video from an RPi to a web page and also to a web server that will detect motion and faces. I'm looking for < 500ms video latency to the webpage (all inside a LAN)

I'm ready to duplicate your approach, but first:

  1. What latency did you see?
  2. Any reason you are aware of that I couldn't also grab frames from the stream on a server?

Thanks!

Tomtomgo commented 7 years ago

Good to hear it helps ;)

  1. The setup we had differs a bit from yours, in that we were not streaming over LAN, but the WWW. There we saw delays of maximum 10 seconds. Curious to see how it works over LAN!
  2. I think that's perfectly possible!

Good luck :)

michaelgundlach commented 7 years ago

Thanks for getting back to me. Feel free to ping this thread in 4 or 5 weeks to find out how it went :)

michaelgundlach commented 7 years ago

Hey @Tomtomgo, I'm getting into it. Some differences vs your instructions that I've noticed, using a brand new RPi 3B+ with Raspbian Jesse:

To get nginx to ./configure:

Somewhere in there I did sudo apt-get update && apt-get upgrade, and I don't know if things would have succeeded without me doing that. If that's an obvious first step for a clean RPi install, maybe you could add that to your list of commands (that I'm following blindly.)

It's not clear if <RASPBERRY_IP> in stream.sh could be "127.0.0.1", since nginx is consuming a local stream. That would be helpful in my use case, where I'm configuring the Pi to then install on a different network.

To cp stream.supervisor.conf /etc/supervisor/conf.d/stream.supervisor.conf, I had to prepend sudo.

Although the camera was physically connected (a camera module), I had to enable the camera module through sudo raspi-config, but still didn't have a /dev/video0 after that. Perhaps your instructions only work with a USB camera instead of a camera module?

There is no actual mention of using the stream.sh script :) I assume I should run it after restarting the supervisor service. When I did run it, I got a bunch of garbage output because you can't put a \ on a line and then also comment on the same line :( So your stream.sh needs to be uncommented or else be one gigantic line.

At that point I can run stream.sh, but get the error about no /dev/video0, probably because I'm on the camera module.

OK, hope this helps you update your instructions :) Any idea how to modify things for a camera module? I am able to read still images off the camera using the picamera module from here .

Tomtomgo commented 7 years ago

Interesting @michaelgundlach, I would guess that the standard PI camera would work simpler than a USB camera. We only tried with a USB one, so wouldn't know how to use the PI one...

Regarding the additional steps for running ./configure, feel free to create a pull request and I'll merge!

unk1nd commented 5 years ago

just do a: sudo apt install libssl-dev libpcre2-dev libpcre3-dev

and you have the openssl library files and the PCRE library files for http_rewrite if you are trying this on e lite raspbian