avatarify-python
avatarify-python copied to clipboard
Cloud GPU use?
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?
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!
@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?
PS. PR #74 is adding remote GPU support, but it's still in testing stage. Maybe some updates from the devs? @alievk ?
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):
- 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
. - Put this nginx.conf file into
c:\nginx\conf
. - Install OBS.
- Launch OBS and set your stream target as:
- Service: Custom
- Server: rtmp://127.0.0.1/live
- Stream Key: test
- In OBS, add your webcam as a source.
- In a command prompt, run
c:\nginx\nginx.exe
to launch the server. - Use a browser to navigate to
http://[Hamachi VPN IP address]:8080
to verify server is working. - In OBS, click Start Streaming button.
- Verify stream by opening
rtmp://[VPN IP address]/live/test
in VLC Player as a network stream. - Click Stop Streaming button.
On NVIDIA VM:
- Run through all instructions to install avatarify.
- In videocaptureasync.py file, make change so:
self.cap = cv2.VideoCapture('rtmp://[VPN IP address]/live/test')
Execution
- Start streaming using OBS.
- In VM, launch
run_windows.bat
in a command prompt.
@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!
@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:
- http://nginx.org/en/download.html
- http://nginx-win.ecsds.eu/download/
- http://nginx-rtmp.blogspot.com/
- https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmp-server-using-nginx.50/
- https://github.com/arut/nginx-rtmp-module/wiki/Directives
- [0] https://github.com/arut/nginx-rtmp-module
- [1] https://github.com/sergey-dryabzhinsky/nginx-rtmp-module
- [2] https://github.com/Cooking-University/nginx-rtmp-module
- [3] https://github.com/winshining/nginx-http-flv-module
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?
Filed an issue at the module page:
- https://github.com/winshining/nginx-http-flv-module/issues/165
Apparently the module included above with --with-http_flv_module
is not the same as the one in link above...
Now you can run on Mac with a good speed using Google Colab
Can i use clould GPU now,because i havn't a NAVID GPU.