ganeshv / egarim

Lenovo Mirage VR180 Camera API client - remote control and custom live streaming
MIT License
27 stars 2 forks source link

Camera not starting custom live stream #3

Closed jgazzara1 closed 3 years ago

jgazzara1 commented 3 years ago

Hello, I am also using this software for a school project. I got the camera to connect to my PC via Bluetooth, but when I initialize the stream, the shutter blinks red and gives an error noise. Any idea what might be causing this?

I also was curious which software you used to view the camera IP stream. I'm trying to use the custom live stream so I can have less latency than YouTube live. Do you have any suggestions for the fastest stream possible that still supports the 180 format?

This software has been incredibly useful otherwise so far. I appreciate you doing this so we can use a less expensive camera.

ganeshv commented 3 years ago

Did you manage to configure wifi and issue commands (like status, configuring capture mode, taking a still photo)? Did you start the live stream using egarim.py (recommended) or the shutter?

There is a get_debug_logs subcommand which will retrieve logs from the camera. Looking through it may give you a hint about what went wrong. It's usually a misconfigured endpoint, or something slightly off while configuring the live mode.

I was using the RTMP module with nginx for VR180. But even that has a 500ms or so delay. That wasn't good enough for my application (telepresence) and I simply couldn't find any (free) livestreaming RTMP solution which was realtime. The only thing which gives near realtime results is the viewfinder mode which uses WebRTC. Unfortunately that's mono, not stereo, and the resolution and video quality are very poor.

jgazzara1 commented 3 years ago

I did manage to configure the wifi through commands (the wifi light was on on the camera). I did not try taking a still photo but I will try that. I attempted to initiate the live stream using egarim.py. I will check the logs ASAP and see if there is any advice there.

I have little experience setting up RTMP endpoints but I will attempt to use nginx. Will the live stream not initialize if I don't have an endpoint running using software like nginx?

ganeshv commented 3 years ago

Camera ---(live stream)--> RTMP end point (e.g. Youtube, nginx) ---> VLC/browser/livestream viewer

Yes, you do need to configure the RTMP endpoint. I will add a simple nginx setup to the documentation, may take a day or so.

ganeshv commented 3 years ago

@jgazzara1 I have added a couple of sections to the README, on taking a photo, and configuring a live stream server using nginx. Let me know if it helps.

jgazzara1 commented 3 years ago

You are a legend. Thank you so much for all the extra help. All of this got much much closer.

The camera does not blink red anymore when I start capture. I'm assuming I setup the server correctly. When you input the rtmp_endpoint, is this the local ip address for the device I'm running the server on?

When the camera successfully initiates a stream, should it make a sound?

And the ffplay command, should that open a window to view the stream or is that done better with a browser or VLC?

ganeshv commented 3 years ago

Yes, if your nginx is running on a server with a local IP of 192.168.1.16, for example, then you should use rtmp://192.168.1.16/egarim_sample as the argument supplied to --rtmp_endpoint.

The camera does make a sound when live streaming starts, and also when it stops. Do check whether both camera and the nginx server are on the same local network (typically this means they should use the same wifi access point). This is not strictly necessary - after all, the camera can stream to Youtube - but it rules out a bunch of network issues.

Yes, ffplay opens a window to view the stream. You can start the ffplay command even before the camera starts broadcasting, so long as nginx is running. As soon as the camera starts, ffplay will open a window. VLC also works.

I suggest you click a photo and retrieve the file using the README. If that works then we know communication over wifi is working fine.

jgazzara1 commented 3 years ago

Ok so I must have misconfigured something when setting up the stream. I did not get the red error beep this time but the camera did not make a sound to let me know it started recording. I will try to retrieve an image to make sure it is on the Wi-Fi but the light being on is a good sign.

One issue I had was when I tried to sudo apt-get install nginx-mod-rtmp it could not be found. Do you know where I can the right version of this?

Thank you again.

ganeshv commented 3 years ago

The names are slightly different in different distributions. Please try libnginx-mod-rtmp, or google for alternative names for your distribution.

jgazzara1 commented 3 years ago

Sorry for such a long delay. I ended up getting the live stream to start and viewed it using your suggestions. The trick for me was going into my router webpage and checking the exact IP address of the device hosting the server with nginx. I also created a new environment with a Raspberry Pi on the latest OS, which helped streamline the process. Thanks for helping me resolve this!

Do you think there is any chance this software could make the stream viewable through the internet instead of just locally? Is that viable with the amount of latency the camera has? Thanks so much for all your help so far.

ganeshv commented 3 years ago

That's great! Good to know it works as an nginx server on RPi as well.

You could setup this nginx on a cloud instance with a public IP, with the exact same steps and it would be viewable through the internet. You may find some providers who offer a hosted solution. The latency is going to be worse than local. Some providers claim ultra low latency. Personally I haven't tried this, so can't offer any recommendations.

jgazzara1 commented 3 years ago

Thank you! I'll look into it.

jgazzara1 commented 2 years ago

Hello! I just wanted to thank you for all your help on my issues with egarim. We were able to complete our Senior Design Project using egarim as part of it. Here is our project page and you can scroll to the bottom to see our final write-up. Thanks again!

ganeshv commented 2 years ago

Thanks for the update, very happy to know it was useful. Congratulations to you and your team mates on completing a great project!