amitv87 / PiP

macOS Picture in Picture and AirPlay Receiver
MIT License
476 stars 25 forks source link

AirPlay latency is a bit high, could you please optimize it? #30

Closed super0214 closed 4 months ago

super0214 commented 8 months ago

The color display of the display renderer under Metal is more accurate than that under Opengl, but the screen will occasionally flicker in Metal mode. I use procreate to live stream my drawings. No matter which mode I use, the delay is more obvious. I hope it can be optimized. It would be better if an option similar to the sharpening adjustment on AirServer could be added to the right-click function. The projected screen image will appear clearer. AirServer does a good job in terms of picture delay and clarity, but the color cast is too outrageous and not suitable for drawing. Looking forward to your reply~

amitv87 commented 8 months ago

Logically I think that Opengl/Metal renderers would produce identical picture quality for the same source. Also I am not sure what would cause flicker in Metal mode. Can you create and share a video to show the behaviour you are referring to.

The airplay implementation in this repo is as simple as it can be, there is zero buffering for both video and audio streams. The video and audio frames are rendered as soon as they are received. The only thing that may have an impact on the latency is the network itself. Can you test the airplay functionality in different networks?

Filters to sharpen/blur/brighten etc can certainly be added.

super0214 commented 8 months ago

Thank you for your reply: I tried it again today and found that the delay has become very low. Maybe there was something wrong with my network the other day. Sorry for the trouble. Opengl does differ slightly from Metal in terms of saturation, but this can be completely ignored if you add a different adjustment filter later. It is recommended to use something like AirServer. The left is the original image, and the right is the real-time adjusted image for easy comparison. Especially the sharpening filter is more important to add this function. The current projection picture is a bit blurry. Looking forward to the update~ Finally, I would like to ask if there will be a Windows version later? Because it’s really easy to use, I want to use it on other devices~

滤镜界面
amitv87 commented 8 months ago

I thought that you were referring to Opengl/Metal renderers option present in the pip preferences cmd + , as shown below. Now I think you are referring to the renderers with respect to procreate app. You may try enabling the HiDPI mode to increase the sharpness. I Hope this solves your issue with respect to picture quality.

image

As far as windows port is concerned, I do not develop native apps for windows anymore. The airplay code I believe is portable to make it work on windows but all the remaining code is in objective-c (all the UI, renderers, decoders, capturers). As this would need a significant development effort, I am open to contributions from the community.