rahul-thakoor / balena-rpiplay

Turn a Raspberry Pi into an Airplay server using RPiPlay to enable screen mirroring on tvs, monitors and projectors.
https://github.com/FD-/RPiPlay
1.41k stars 57 forks source link

rpiplay performance #15

Open zhanghaobb opened 2 years ago

zhanghaobb commented 2 years ago

This is a great tool, easy to use and quick. I have tried under 3B+ and 4, both of them had frame lost, I can watch the video but not quite smooth, how can I improve that?

rahul-thakoor commented 2 years ago

Hi, how are you deploying the app? Are you using the open fleet from balenaHub or are you maintaining your own fleet?

The open fleet uses the -l low-latency mode already as descirbed here. If you have your own fleet, you try to turn it off to see if it improves performance for you. You need to set the environment variable AIRPIPLAY_LATENCY_MODE to 0. See more docs here

zhanghaobb commented 2 years ago

Thank you for the quick response. I simply used this link: https://hub.balena.io/gh_rahul_thakoor/balena-rpiplay download the image, and flash it. I believe it is BalenaHub. I updated the variable of LATENCY, let me check the performance later.

Now I successfully deployed the release, there are some warnings here, is there any problem? The program 'rpiplay' uses the Apple Bonjour compatibility layer of Avahi. 18.11.21 19:31:33 (+0800) rpiplay WARNING Please fix your application to use the native API of Avahi! 18.11.21 19:31:33 (+0800) rpiplay WARNING For more information see http://0pointer.de/blog/projects/avahi-compat.html

rahul-thakoor commented 2 years ago

No issues with those warnings

zhanghaobb commented 2 years ago

I tested this for a few days, sometimes it works well, but after a while, video streaming became chopping with broken sound, I used pi-3B+ and pi-4, both are not ideal. I checked the CPU performance, mostly under 50% or at lower %, not sure if it is wifi performance, can we set it to 5.8G only?

rahul-thakoor commented 2 years ago

Wired connection is recommended for best performance

If you want to force to 5.8G only, you will have to modify the network connection file. Please see https://www.balena.io/docs/reference/OS/network/2.x/#wifi-setup for more info

You might find this helpful too https://forums.balena.io/t/force-networkmanager-to-connect-to-2-4ghz/282156/3

zhanghaobb commented 2 years ago

I did use wired and Wifi. The same.

rahul-thakoor commented 2 years ago

can we set it to 5.8G only?

are you using the same SSID for both the 2.4 and 5 GHZ networks?

zhanghaobb commented 2 years ago

Yes, using same SSID, this is convenient for compatibility. Let me try to disable 2.4G and see how it works.

zhanghaobb commented 2 years ago

There is one more issue identified, when I was trying to airplay the 2160p video, it failed to cast, it is fine and understandable because of the speed, but after a few stumbles, the pi's audio started to output constant "white noise", it can reproduce every time.