FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.34k stars 72 forks source link

RAM Question (and more) #257

Closed eliklein02 closed 6 months ago

eliklein02 commented 6 months ago

Hey, I'm running UxPlay on a raspberry pi 4 b, and on the phone it works with not too much delay (a bit tho), but when i connect my macbook, there's significant lag, I run it like this: uxplay -avdec -vs kmssink. Could the fact that i only have 1GB RAM be a reason, or is there something else i can do to make it better?

Also, I see the terminal in the background (using rpi os lite) when i airplay my phone as it doesnt take up the whole screen, is there something i can do?

Also, what are the chances there's a way to make it so that the youtube video or whatever it is I'm playing, maybe spotify, plays like I'm using a regular  TV, where it fetches the video on the receiving device? And doesn't use batter or network from the iPhone? Or if it isn't possible to do that, is there a project that is runnable on a pi that does this?

Thank you tons. IMG_3789

thiccaxe commented 6 months ago

It could be a matter of simply that the MacBook has a larger screen size (pixels) than the phone. This means more computation for the pi. To mitigate this maybe you could request a display size with the appropriate flag. (-s)

As to your final point, it has been done before at its most bare minimum, in that the iOS device sends a youtube url to an airplay server. However actually controlling this stream and cooperating with the iOS device is a long shot. I would see if other solutions like chrome cast servers might work

eliklein02 commented 6 months ago

Thanks for the answer. How would I go about setting the res? And you mentioned computation, which I’m gonna assume means it’s heavy on the RAM. Should I go for the 2GB if this doesn’t help? Or it isn’t a RAM issue at all and it should work on 1GB


From: thiccaxe @.> Sent: Wednesday, December 27, 2023 11:56:15 PM To: FDH2/UxPlay @.> Cc: eliklein02 @.>; Author @.> Subject: Re: [FDH2/UxPlay] RAM Question (and more) (Issue #257)

It could be a matter of simply that the MacBook has a larger screen size (pixels) than the phone. This means more computation for the pi. To mitigate this maybe you could request a display size with the appropriate flag.

As to your final point, it has been done before at its most bare minimum, in that the iOS device sends a youtube url to an airplay server. However actually controlling this stream and cooperating with the iOS device is a long shot. I would see if other solutions like chrome cast servers might work

— Reply to this email directly, view it on GitHubhttps://github.com/FDH2/UxPlay/issues/257#issuecomment-1870821918, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARLGCORMFU4KP3ATULXXRHLYLT3W7AVCNFSM6AAAAABBFB4D5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZQHAZDCOJRHA. You are receiving this because you authored the thread.Message ID: @.***>

fduncanh commented 6 months ago

why are you using -avdec (software CPU h264 video decoding) on a pi 4B

You should be using the GPU with v4l2 hardware h264 video decoding. Read the uxplay README .

Just run uxplay with -vs kmssink (and no -avdec).

The hardware decoding is only available on Raspberry Pi OS, Ubuntu and Manjaro. It uses a broadcom driver maintained by R Pi outside the mainline kernel.

eliklein02 commented 6 months ago

I read it, but if I remember correctly, when I ran it, I only saw eight colors and it was super distorted and somebody in the issues had said to use it to fix that


From: fduncanh @.> Sent: Thursday, December 28, 2023 7:39:07 AM To: FDH2/UxPlay @.> Cc: eliklein02 @.>; Author @.> Subject: Re: [FDH2/UxPlay] RAM Question (and more) (Issue #257)

why are you using -avdec (software CPU h264 video decoding) on a pi 4B

You should be using the GPU with v4l2 hardware h264 video decoding. Read the uxplay README .

Just run uxplay with -vs kmssink (and no -avdec).

— Reply to this email directly, view it on GitHubhttps://github.com/FDH2/UxPlay/issues/257#issuecomment-1871128683, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARLGCOVHPATVC5Z4F3OSCGTYLVR6XAVCNFSM6AAAAABBFB4D5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGEZDQNRYGM. You are receiving this because you authored the thread.Message ID: @.***>

fduncanh commented 6 months ago

@eliklein02

It works perfectly.

You are doing something wrong.

What Linux are you running?

fduncanh commented 6 months ago

which version of R Pi OS lite? latest? which Gstreamer version?

eliklein02 commented 6 months ago

Yes I just downloaded the lite reversion from their website. I think it’s bookworm


From: fduncanh @.> Sent: Thursday, December 28, 2023 7:58:15 AM To: FDH2/UxPlay @.> Cc: eliklein02 @.>; Mention @.> Subject: Re: [FDH2/UxPlay] RAM Question (and more) (Issue #257)

which version of R Pi OS lite? latest?

— Reply to this email directly, view it on GitHubhttps://github.com/FDH2/UxPlay/issues/257#issuecomment-1871146821, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARLGCOVIVKQM4DBBSKH2GDDYLVUGPAVCNFSM6AAAAABBFB4D5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGE2DMOBSGE. You are receiving this because you were mentioned.Message ID: @.***>

eliklein02 commented 6 months ago

and latest gstream yes. and on the iphone when i mirror a video it's not at all smooth I just realized. You don't think the 1GB is the issue? I followed all the steps correctly

eliklein02 commented 6 months ago

Sorry the color thing doesn't happen when I don't use -avdec, but the lag is significantly worse when I don't

fduncanh commented 6 months ago

Using the GPU should be much faster. Check you are using it: This is from the patching instructions in the wiki: (GStreamer 1.22 and later does not need patching.)

(Raspberry Pi 4 only) First check that your Raspberry Pi's firmware is up to date

The Video4Linux2 plugin works by using a kernel module to access the firmware for the Broadcom GPU which is written >in the Pi's EEPROM chip. To check that the firmware is up to date, run

sudo rpi-eeprom-update

It this shows updates are available, run "sudo rpi-eeprom-update -a", and then reboot to install them. After the reboot, run "sudo rpi-eeprom-update" again to verify that the firmware is now up to date. Next, verify that you have a complete Video4linux2 plugin.

Use gst-inspect-1.0 video4linux2 (In Debian-based systems, this requires that gstreamer1.0-tools is installed):

pi@raspberrypi:~ $ gst-inspect-1.0 video4linux2 Plugin Details: Name video4linux2 Description elements for Video 4 Linux Filename /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvideo4linux2.so Version 1.18.4 License LGPL Source module gst-plugins-good Source release date 2021-03-15 Binary package GStreamer Good Plug-ins source release Origin URL Unknown package origin

v4l2src: Video (video4linux2) Source v4l2sink: Video (video4linux2) Sink v4l2radio: Radio (video4linux2) Tuner v4l2deviceprovider: Video (video4linux2) Device Provider v4l2jpegdec: V4L2 JPEG Decoder v4l2h264dec: V4L2 H264 Decoder v4l2h264enc: V4L2 H.264 Encoder v4l2convert: V4L2 Video Converter v4l2video18convert: V4L2 Video Converter v4l2jpegenc: V4L2 JPEG Encoder

10 features: +-- 9 elements +-- 1 device providers

UxPlay will need the v4l2h264dec and v4l2convert plugins, and v4l2h264dec needs to have fixes from gstreamer-1.21 development series backported to it. If none of the decoders, encoders and converters are shown, your system may be missing a required kernel module such as bcm2835_codec.ko.

Check for the Broadcom kernel drivers with

lsmod | grep bcm

This should show that the bcm2835_codec module is present.

Without the bcm2835_codec kernel module, and the video4linux2 decoders, hardware decoding of h264 video by UxPlay will not be available on the RPi. Correct this before proceeding. The most likely cause for a missing v4l2h264dec plugin is that firmware is not updated, gstreamer1.0-plugins-good is not installed, or that kernel modules that access the firmware are missing.

There is some setting in raspi-config for how much memory to allocate to the GPU.

EDIT UxPlay was not tested on a device with less than 4GB memory.