alexballas / go2tv

Cast media files to UPnP/DLNA Media Renderers and Smart TVs.
MIT License
468 stars 45 forks source link

Is it possible to mirror the screen? #51

Open OliveiraHermogenes opened 1 year ago

OliveiraHermogenes commented 1 year ago

Hi, there.

In my university, we've got projectors caged to the ceiling which otherwise work, except that it is very cumbersome to get cables from there.

I've got one of those cheap "Anycast" HDMI dongles that can act as a DLNA/UPnP renderer and would like to use it, instead of a long HDMI cable, to share my screen with students during a lecture. Go2TV works great for casting videos, but I couldn't figure out a way to cast/mirror my screen. Tried piping ffmpeg's x11grab output, but that didn't work ("Broken pipe"). If I dump the screen to a WebM/VP8 file and give that to Go2TV, then mirroring starts (although with some delay), but then breaks off after a few seconds.

Is there an easy way to implement this, or could you give me some pointers as to how to get this working?

Thank you very much for your work!

alexballas commented 1 year ago

Hello!

I also tried last month to "trick" ffmpeg to cast my screen but with no luck. Didn't spend too much time on it however. When you dump the screen to a WebM file and pass that to Go2TV, it sees it as a complete video file and only casts the data that already recorded up to this point. Maybe if there was a mode that treated this file as a sequential stream of data rather than a seekable object, maybe we could cast the full thing, but still that would be a hack and the delay would be massive (as you also identified). Something like changing https://github.com/alexballas/go2tv/blob/main/httphandlers/httphandlers.go#L300 to a io.Copy when in screen casting mode? Just speculating, I would need to run some tests.

The standard way to cast / mirror your screen is with the Wifi Display / Miracast protocol which is an entirely different thing from the UPNP implementation in Go2TV.

I'm a linux user myself but I believe that Windows support wireless display / anycast natively.

pataquets commented 1 year ago

@OliveiraHermogenes VLC has a screen:// input source you might find useful.