Monday, February 1, 2021

Streaming your Android screen to your Raspberry Pi: freeware method

πŸ• Duration: Minutes
πŸ”§ Difficulty: Easy
🌟🌟 Interest: Serviceable
[Updated 2021, July 19th: Added uv4l]
 
In this article I will suggest you a solution that can have multiple applications.
 
Streaming devices to your Pi can actually be interesting as a matter of fun but also can be interesting if you are planning to use a Pi as an all-purpose device for your small company and wish to stream professional content to a large screen or a beamer. 

Sender or Receiver

Most casting apps aren't really casting apps: the sender will actually upload a file or forward an internet link and then give the order to the receiver to read it. 
 
Streaming what really happens on your screen to your receiver is much more demanding than just sending a file and giving an order to your receiver. 
 
That is why most developers won't bother coding such an app and will just bloat their sender and receivers by codec functions that do the same instead of really mirroring the screen.

The fake good idea: Kodi

Why is Kodi a bad idea? Everyone knows Kodi is a multimedia-oriented system. It plays music, movies, pictures, radio streams, every media thing that you can find. 
So can Kodi be rich enough to stream my screen? Yes and no. And definately no.

Like it or not, Kodi is a client. It means that Kodi fetches things. It does not receive things. Does it make it impossible to stream there? No. Does it make it unreasonable to stream there? Yes.

To stream your screen to Kodi, the "sender" will actually have to act as a broadcasting server. 
You will have to start a VLC streaming server on the sender and pull your broadcasting on Kodi. Performance-wise this is an aberration. 
A workstation must it be a PC or a small android device cannot perform well as a broadcasting server. You will end frustrated with poor performance. 
Trying software workarounds like trying Serviio and other servers will only confirm how impossible it is to get a decent performance, and will drastically damage the general behaviour (as in, even when you are doing something else) of your workstation. You might end needing to reinstall your workstation OS because it has become so slow that it will be extremely annoying to use.

A decent alternative: ClockworkMod (CwM) Allcast receiver + Allcast + Screen Recording and Mirror

I like CwM guys, they did many things for android. If you did some rooting in the past, you must remember CwM recoveries. Now we almost all use TWRP, but CwM sure did the job back in the days.
 
This method needs 2 Android systems. The good thing is that PINN can easily install a version of LineageOS on your PI. Your phone or tablet (sender) doesn't need root, and your receiver (Pi) has root "supersu" installed by default in LineageOS in PINN.

On your PI big screen, in LineageOS, install ClockworkMod Allcast receiver.


After installing, run Allcast receiver on your Pi and run Screen Recording on your Phone.
screen mirrored on Raspberry Pi PokΓ©mon GO
A mirrored Android phone to Raspberry Pi Android.
Don't be fooled, PokΓ©mon GO does not run on Raspberry Pi.
You will not pass safetynet.


 
Allcast sender will help you stream content instead of your screen.
 
The performance is honorable: you will have a shift of 1-2 seconds between your android sender and your receiver but past that your large screen will play fluidly (10~15 constant FPS).

Of course that 1-2 seconds latency is a bit bothersome if you want to play real time games like FPS/RTS but if you just want to do a showing to people about how you can see PokΓ©mon GO on a large screen, send your photos without loading them physically on your Pi or watch internet sites with your friends this is an excellent free solution. 
You might also find the idea interesting in a corporate point of view: it is actually easy to stream Microsoft PowerPoint(TM), OpenOffice Impress or even Prezi dynamic presentations this way and it will look professional.
 
[Updated 2021, July, 19th]

Alternative: uv4l

If your remote machine (Android or PC) provide a recent version of Firefox or Chrome, you can try installing uv4l. The main advantage is that uv4l can install itself over a Raspberry Pi OS when it's sad to have an Android running only for Screen Mirroring. 
See the uv4l tutorial on uv4l official site: https://www.linux-projects.org/uv4l/tutorials/screen-mirroring/

TL/DR:

  • Install LineageOS on your Pi from PINN
  • Install Allcast Receiver on your Pi in LineageOS
  • Install Allcast and Screen Mirror on your android phone or tablet. No need root on phone.
  • Run Allcast Receiver and either Allcast or Screen Mirror on your android phone
  • All set, everything you are doing on your phone will be streamed

The pi gamer

No comments:

Post a Comment

Play ET: Legacy on Raspberry Pi [FPS]

πŸ•πŸ• Duration: A few hours πŸ”§ Difficulty: Easy 🌟🌟🌟🌟 Interest: Hours of fun