Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud GPU use? #115

Open
jamezm79 opened this issue Apr 22, 2020 · 11 comments
Open

Cloud GPU use? #115

jamezm79 opened this issue Apr 22, 2020 · 11 comments

Comments

@jamezm79
Copy link

jamezm79 commented Apr 22, 2020

Hi. I have a GeForce GTX 1050i and it clearly isn’t up to the task. Performance is woeful (although Task Manager suggests only 7-8% load so maybe something else is wrong).

Is there any viable way to connect with a cloud-based GPU for a fee whilst still using my local webcam?

@jenssalu
Copy link

This worked for me:

On my laptop, I installed nginx as rtmp server & OBS to stream my webcam to Cloud machine.
Created a VPN for free with Hamachi. (you have to start the rtmp server on the new VPN ip address.)
In the videocaptureasync.py file, change self.cap = cv2.VideoCapture(self.src) to self.cap = cv2.VideoCapture(' your rtmp url ').

Good luck!

@E3V3A
Copy link

E3V3A commented Apr 24, 2020

@jenssalu
Thanks for sharing your idea, but I find it a little too brief to follow. It's not clear where you are setting up what. So can you please expand your method a little more, and perhaps we can put it in the FAQ? Also, what is the latency and frame rate you get from this?

@E3V3A
Copy link

E3V3A commented Apr 24, 2020

PS. PR #74 is adding remote GPU support, but it's still in testing stage.
Maybe some updates from the devs? @alievk ?

@maxxwizard
Copy link

I tried the idea written by @jenssalu. The results are very poor - 1 FPS - likely due to all the network latencies. I would suggest using hardwired (ethernet) connections and avoid WiFi to see if you'll get more luck than I did.

Here's what I did for my Windows-only attempt.

Setup
I created an NVIDIA Quadro Virtual Workstation on Microsoft Azure.

I installed Hamachi on both my video capture machine and on my NVIDIA VM. I created a VPN to join the 2 computers together.

On video capture machine (instructions adapted from here):

  1. Install a version of nginx that packages the RTMP module. I extracted http://nginx-win.ecsds.eu/download/nginx%201.7.11.3%20Gryphon.zip to c:\nginx.
  2. Put this nginx.conf file into c:\nginx\conf.
  3. Install OBS.
  4. Launch OBS and set your stream target as:
  • Service: Custom
  • Server: rtmp://127.0.0.1/live
  • Stream Key: test
  1. In OBS, add your webcam as a source.
  2. In a command prompt, run c:\nginx\nginx.exe to launch the server.
  3. Use a browser to navigate to http://[Hamachi VPN IP address]:8080 to verify server is working.
  4. In OBS, click Start Streaming button.
  5. Verify stream by opening rtmp://[VPN IP address]/live/test in VLC Player as a network stream.
  6. Click Stop Streaming button.

On NVIDIA VM:

  1. Run through all instructions to install avatarify.
  2. In videocaptureasync.py file, make change so: self.cap = cv2.VideoCapture('rtmp://[VPN IP address]/live/test')

Execution

  1. Start streaming using OBS.
  2. In VM, launch run_windows.bat in a command prompt.

@jenssalu
Copy link

jenssalu commented Apr 25, 2020

@maxxwizard, Nice! That's almost the same setup as I did it!
Thank you for completing the setup! Completely forgot it!
I just run the rtmp server on my vpn ip address instead of 127.0.0.1!

My laptop (GeForce GTX 1050) got an fps of max 6 fps! On my VM (GPU: P6000), I was able to get a fps of 16.
I'm quiet happy with that result, when you consider that my webcam has a fps of 30.

The last days, I was using a poor wifi connection, but still managed to have a latency of max 1.5 seconds!

@E3V3A
Copy link

E3V3A commented May 1, 2020

@maxxwizard
Great write-up, however, I am wondering why you are using a super outdated nginx?
The Gryphon is >5 years old, so why are you not using the latest. Any nginx that old has a bunch of serious security vulnerabilities. I wouldn't give a server like that to my worst enemy.

Same goes for the outdated/abandoned RTMP plugin, it comes packaged with [0]. The better maintained ones seem to be [1,2] and the best one seem to be the nginx-http-flv-module in [3]. But then again,what do I know!

I'm looking to try to get this working with a more recent version nginx.


References:

@E3V3A
Copy link

E3V3A commented May 2, 2020

Ok, I now get it. From Readme nginx-win version.txt:

Commercial subscription only modules:
= Streaming with nginx-rtmp-module
...
rtmp, 1.7.12.1 is the last free version with rtmp, we do have a rtmp
special offer for the 1.9 branch (which without rtmp you could use
to tcp load balance 1.7.12.1 with rtmp)

I tried to install nginx 1.18.0, which are showing that it's supposedly compiled with --with-http_flv_module. However, including the config from their readme doesn't work. (It's not recognized.)

configure arguments:
 --with-cc=cl
 --builddir=objs.msvc8
 --with-debug
 --prefix=
 --conf-path=conf/nginx.conf
 --pid-path=logs/nginx.pid
 --http-log-path=logs/access.log
 --error-log-path=logs/error.log
 --sbin-path=nginx.exe
 --http-client-body-temp-path=temp/client_body_temp
 --http-proxy-temp-path=temp/proxy_temp
 --http-fastcgi-temp-path=temp/fastcgi_temp
 --http-scgi-temp-path=temp/scgi_temp
 --http-uwsgi-temp-path=temp/uwsgi_temp
 --with-cc-opt=-DFD_SETSIZE=1024
 --with-pcre=objs.msvc8/lib/pcre-8.44
 --with-zlib=objs.msvc8/lib/zlib-1.2.11
 --with-http_v2_module
 --with-http_realip_module
 --with-http_addition_module
 --with-http_sub_module
 --with-http_dav_module
 --with-http_stub_status_module
 --with-http_flv_module                        <--- THIS !
 --with-http_mp4_module
 --with-http_gunzip_module
 --with-http_gzip_static_module
 --with-http_auth_request_module
 --with-http_random_index_module
 --with-http_secure_link_module
 --with-http_slice_module
 --with-mail
 --with-stream
 --with-openssl=objs.msvc8/lib/openssl-1.1.1f
 --with-openssl-opt='no-asm no-tests -D_WIN32_WINNT=0x0501'
 --with-http_ssl_module
 --with-mail_ssl_module
 --with-stream_ssl_module

Any idea how to implement and configure this?

@E3V3A
Copy link

E3V3A commented May 2, 2020

@E3V3A
Copy link

E3V3A commented May 15, 2020

Apparently the module included above with --with-http_flv_module is not the same as the one in link above...

@alievk
Copy link
Owner

alievk commented May 24, 2020

Now you can run on Mac with a good speed using Google Colab

@18845045369
Copy link

Can i use clould GPU now,because i havn't a NAVID GPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants