Rafostar / gnome-shell-extension-cast-to-tv

Cast files to Chromecast, web browser or media player app over local network.
GNU General Public License v2.0
289 stars 16 forks source link

[Feature request] Casting desktop #5

Closed der-ali closed 4 years ago

der-ali commented 5 years ago

is it possible to cast my desktop to chromecast ? If not is this feature planned ?

Rafostar commented 5 years ago

Casting desktop is in Chrome browser (unfortunately without sound). I made this extension as an easy way to cast files. Although casting desktop through included tools is possible, we would have to convert it to video and stream it as such. I once experimented with ffmpeg function x11grab to stream desktop, but due to converting and chromecast forced buffering the delay was too high.

thermatk commented 5 years ago

delay is not a problem, if sound corresponds to video it would be a cool option, just as you said with ffmpeg capturing screen from x11 and audio from pulse

Rafostar commented 5 years ago

AFAIK Mkchromecast uses ffmpeg's x11grab to stream desktop. Did anyone used Mkchromecast? How long the delay is? Does it work under Wayland (name suggests otherwise)?

corebots commented 5 years ago

I second this request. casting the desktop with video in sync with sound is something that would be really really great! Thanks for this extension btw.

Drakulix commented 5 years ago

What should be used to implement this feature is the xdg-desktop-portal. More specifically the ScreenCast protocol: https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.impl.portal.ScreenCast

Gnome has an experimental implementation, that also works on wayland (which is not the case for x11grap) and should become stable in the near future.

While portals were specifically designed for flatpak apps, they can be used by "normal" programs and doing so is encouraged for protocols like ScreenCast.

Rafostar commented 5 years ago

This is nice and all, but the biggest problem here is that Chromecast is too simple device to implement something like that. The only thing that official google API supports are videos, music and pictures. Finito.

I agree with you that something like this should be professionally used when designing your own sender and receiver apps. But here I have to work with the only thing that google device supports i.e. mp4 files :disappointed:

thermatk commented 5 years ago

@Rafostar how about cvlc? The Raspberry Pi community uses something like that

cvlc screen:// :screen-fps=25 :screen-caching=100 --sout '#transcode{vcodec=MJPG,vb=0,width=1022,height=575,acodec=none}:http{mux=ogg,dst=:8080/}'

I guess one can just as well use H264 for video and catch the sound properly, and then it's there for anyone with VLC :+1:

Upd: tested, video is nice, sound not caught for now Upd2: perfect stream with sound on X11 cvlc screen:// --input-slave=pulse://alsa_output.usb-Logitech_G933_Artemis_Spectrum_Snow-00.iec958-stereo.monitor :screen-fps=25 :screen-caching=100 --sout '#transcode{vcodec=H264,vb=0,width=1920,height=1080,acodec=mp3}:http{mux=ts,dst=:8080/}' I don't know what the codec requirements for chromecast are, but should be doable

Rafostar commented 5 years ago

@thermatk Nice find. Can you try it on Wayland? Distros started switching away from X11 (e.g. Fedora), so I would like to have this working on Wayland too.

thermatk commented 5 years ago

I guess for wayland to work one needs vlc-git, as of now it just doesn't work

Additional info for the command above, so at least it's complete under X11:

  1. To find the pulseaudio device names one can use this command pacmd list-sources | awk '/name:.+\.monitor/'
  2. Then cvlc screen:// --input-slave=pulse://AUDIODEVICE FROM 1:screen-fps=FPS:screen-caching=CACHING DELAY--sout '#transcode{vcodec=OUTPUT VIDEO CODEC,vb=0,width=OUTPUT WIDTH,height=OUTPUT HEIGHT,acodec=OUTPUT AUDIO CODEC}:http{mux=OUTPUT MUXER,dst=:OUTPUT PORT/}'
thermatk commented 5 years ago

Until PipeWire is ready, that's all I could find about Wayland screencasting https://wiki.gnome.org/Projects/Mutter/RemoteDesktop, which is an implementation of interface previously mentioned here. But considering Wayland isn't ready (at least in screencasting sense), couldn't you add an X11-only codepath for now?

ZanderBrown commented 5 years ago

https://github.com/benzea/gnome-screencast

Rafostar commented 5 years ago

https://github.com/benzea/gnome-screencast

That one uses Miracast. People tend to mix those two, but Chromecast and Miracast are two totally different protocols!

@thermatk I have been getting positive results with similar commands as you did, but with GStreamer. GStreamer was designed for streaming after all and it supports both x11 and Wayland through PipeWire.

I don't know what the codec requirements for chromecast are, but should be doable

Yeah, Chromecast is not only picky about codecs but it also needs a proper full http server (not tcp) and a few HTTP Headers on a source web page.

Anyway, I was successfully able to stream desktop to Chromecast as long as network connection (between router and Chromecast was fast and stable). Because Chromecast does NOT have an option to turn off buffering, delay is increasing when it cannot keep up with receiving data (which makes me wonder how Google plans to use Stadia gaming service on it). Still needs more tuning and testing...

ZanderBrown commented 5 years ago

@Rafostar my point was more that it streams gnome-shell regardless of x11 vs wayland, where/how it sends the stream is superfluous

Most relevent point being nd-screencast-portal.c/.h which gives you a GstElement

Rafostar commented 5 years ago

Anyone up for some testing? cast-to-tv-desktop-addon

cd /tmp
git clone https://github.com/Rafostar/cast-to-tv-desktop-addon.git
cd cast-to-tv-desktop-addon
make install

Restart gnome-shell, enable extension, go to Cast to TV settings and click Install npm modules. You should see a text saying that Desktop Add-on is being installed printed in built-in terminal.

Also required is GStreamer-1.0 with it's plugins-good, plugins-bad and plugins-ugly packages.

This is early WIP, but I would appreciate it if everyone who tested it reported back here. No sound and only x11 for now (audio support is ready). We will enable audio if initial tests will be successful.

mooninite commented 5 years ago

I tried it on gnome shell 3.32.2, but it failed to load:

gnome-shell[1886]: Extension "cast-to-tv-desktop-addon@rafostar.github.com" had error: ImportError: No JS module 'shared' found in search path

Rafostar commented 5 years ago

I tried it on gnome shell 3.32.2, but it failed to load:

gnome-shell[1886]: Extension "cast-to-tv-desktop-addon@rafostar.github.com" had error: ImportError: No JS module 'shared' found in search path

You didn't remove Cast to TV v9 before installing, right? For this to work you need to have both extensions enabled. And what was your linux distro?

mooninite commented 5 years ago

Sorry, I was unaware of the dependency between the two. I have now installed both extensions from the latest git master checkouts. They are now activated and appear to be functioning.

When I select "Desktop" from the cast selection my Chromecast changes to black for a second, then it looks like a movie player interface appears playing a video called "none" for a few seconds and then it flashes back to black and then displays a blue cast icon in the middle of the TV. No desktop is displayed. I've tried activating the Desktop cast a few times and the result is the same.

I can cast a video to the Chromecast with no problem.

Distro: Fedora 30 x86_64 (ffmpeg 4.1.3)

Rafostar commented 5 years ago

@mooninite If you have it working for videos I assume that you installed nodejs and all the other dependencies as stated in readme for fedora.

As I written before, for desktop streaming also required is GStreamer-1.0 with its plugins-good, plugins-bad and plugins-ugly packages (I forgot to mention some of these plugins earlier, sorry).

I know that it is a lot, but all provide required elements for desktop recording and encoding.

So in case of Fedora:

sudo dnf install gstreamer1 gstreamer1-plugins-base gstreamer1-plugins-good gstreamer1-plugins-bad-free gstreamer1-plugins-ugly

If I didn't forget anything you should be able to cast a desktop after installing above.

EDIT: Also Fedora is one of distros that uses Wayland session by default. You need to switch to x11 (Xorg) by selecting it during login (gear icon next to sign in button).

mooninite commented 5 years ago

Yes, nodejs is installed. I'm using an X11 session. I also have had all of the gstreamer1 packages installed.

gstreamer1-plugins-bad-free-1.16.0-1.fc30.x86_64
gstreamer1-plugins-bad-freeworld-1.16.0-1.fc30.x86_64
gstreamer1-plugins-base-1.16.0-1.fc30.i686
gstreamer1-plugins-base-1.16.0-1.fc30.x86_64
gstreamer1-plugins-good-1.16.0-1.fc30.x86_64
gstreamer1-plugins-good-gtk-1.16.0-1.fc30.x86_64
gstreamer1-plugins-ugly-1.16.0-2.fc30.x86_64
gstreamer1-plugins-ugly-free-1.16.0-2.fc30.x86_64
Rafostar commented 5 years ago

@mooninite Could you send me output of

ls ~/.local/share/gnome-shell/extensions/cast-to-tv-desktop-addon@rafostar.github.com

I want to make sure all files are in place.

mooninite commented 5 years ago
$ ls ~/.local/share/gnome-shell/extensions/cast-to-tv-desktop-addon@rafostar.github.com
extension.js  metadata.json  node_scripts  package-lock.json  widget.js
LICENSE       node_modules   package.json  README.md
Rafostar commented 5 years ago

Everything seems to be installed properly. I went through the code to try to find possible cause. The first thing I noticed is that the screen resolution is set to 1920x1080. Is yours screen res different? I will try installing this on Fedora live iso next week to see if I run into any problems.

mooninite commented 5 years ago

Yes, I am running a 2560x1440 144hz monitor.

Rafostar commented 5 years ago

Yes, I am running a 2560x1440 144hz monitor.

And that is the reason, why it is not working for you. There is no resolution detection and scaling yet (I will try to implement those in the future). Can you temporarily change system resolution to 1920x1080@60 and try casting again?

mooninite commented 5 years ago

OK. Changing to 1080p does have it working. There is about a 5 second delay though. Single CPU thread usage at about ~65%.

CPU: 4790k GPU: NVIDIA 750Ti (430.14 driver)

1989gironimo commented 5 years ago

The desktop-addon cannot find my Chromecast, but Chromium can. Tried to configure it in the settings dialogue but it's not there as well.

Rafostar commented 5 years ago

The desktop-addon cannot find my Chromecast, but Chromium can. Tried to configure it in the settings dialogue but it's not there as well.

PC and Chromecast need to be on the same network. MDNS has problems finding Chromecast on some network configurations (depends on router and network card). In that case check your current Chromecast IP in either router web config or google home app and use cast-to-tv-config to manually set IP from linux terminal.

1989gironimo commented 5 years ago

Ok, after manual configuration it can find the chromecast, but after enabling the desktop stream it just displays "none" as the video title and a black screen with the casting symbol. I'm using it on a debian based distro with 1920x1080 as the display resolution.

(everything else -music etc.- doesn't work either, so it may be something else)

Rafostar commented 5 years ago

@1989gironimo Don't know what your network configuration is, but this might be a firewall issue. When you open extension settings you should see your PC local IP at the bottom. Try changing your receiver type to web browser and accessing that link using web browser on other device (other pc or smartphone) on the same network that Chromecast is.

1989gironimo commented 5 years ago

Ok, streaming works now, I had to edit iptables with sudo iptables -I INPUT -p tcp --dport 4000 -j ACCEPT I suggest to add this to the documentation. But desktop streaming still doesn't work, it just hangs as described before, where can I start debugging? :)

EDIT: I saw in one of your answers, that Wayland is not supported. Ok, that's the reason why it's not working properly.

Rafostar commented 5 years ago

Ok, streaming works now, I had to edit iptables with sudo iptables -I INPUT -p tcp --dport 4000 -j ACCEPT I suggest to add this to the documentation.

OK. I will add this to docs. Interesting that Debian default firewall is that aggressive, as I usually test this on Ubuntu and Fedora and both allow accessing local computers without firewall tinkering. Since that got you working it might be possible that MDNS device scanning can be fixed the same way. It uses UDP port 5353 btw. More info on wikipedia.

But desktop streaming still doesn't work, it just hangs as described before, where can I start debugging? :)

Desktop streaming is a work in progress and I have not implemented debugging in that part yet. Sorry. For now just make sure you have gstreamer1.0 with all its plugins (do not mistake gstreamer 0.10 with 1.0 as they are different). And it looks like Debian have some of the required GStreamer binaries in separate package called gstreamer1.0-tools make sure you have that installed too.

1989gironimo commented 5 years ago

It's PureOS, not debian itself. But adding that to the docs is still usefull nonetheless. Adding 5353 to iptables doesn't do anything, maybe there's something missing as well, I'll have a look the next few days.

EDIT: And installing gstreamer1.0 doesn't work because of an unmet dependency with gstreamer1.0-python3-dbg-plugin-loader aber 1.14.4-1+b1 - I have to contact the PureOS devs about this, it doesn't seem to be the right version.

Rafostar commented 5 years ago

OK. Remember that on debian based distros besides gstreamer1.0 and its plugins also need gstreamer1.0-tools so check if their versions match too.

1989gironimo commented 5 years ago

I've verified, which gstreamer1.0 package may be missing and what the error means, but it seems, there are two different packages which can be installed for the same base functionality:

Everything else (incl. the plugins good, bad, ugly) is installed and in my opinion it doesn't make a real difference which of both are installed.

thermatk commented 5 years ago

Tested, works great on Manjaro (Arch) X11. CPU load is barely to notice on desktop Kaby Lake

Rafostar commented 5 years ago

@thermatk Thanks for testing. Using the command you provided earlier pacmd list-sources | awk '/name:.+\.monitor/' list of system audio output devices can be obtained. After determining your currently used sound device name, run below commands while replacing only source in second line with your own device name:

pacmd load-module module-null-sink sink_name=cast_to_tv sink_properties=device.description=WirelessDisplay
pacmd load-module module-loopback source=alsa_output.pci-0000_00_01.1.hdmi-stereo.monitor sink=cast_to_tv adjust_time=5 latency_msec=1 sink_dont_move=true

Next select new WirelessDisplay sink in System Settings -> Sound. On the next cast, this should enable audio on the receiver while not playing it on PC (hearing it from both devices with delay is annoying).

Everyone interested in having audio, please try it and let me know if it works correctly. All changes using pacmd are temporary until next pulseaudio/system restart, so there is no risk in breaking os configuration.

thermatk commented 5 years ago

@Rafostar tested, sound is working, it's in sync with picture as far as I can tell after a small test. There is a nasty bug I found in the video part though, which I didn't see before: it's leaking memory, if you stop streaming. So I start streaming desktop, RAM consumption is stable, then if I unplug the Chromecast or stream on it from another device, the desktop RAM consumption is linearly growing until it eats all 16 GB and X.org dies. The only way to prevent death I found is to kill the gst-launch-1.0 process

thermatk commented 5 years ago

Narrowed down, the process which actually goes berserk and starts eating RAM is Xorg. Maybe one should somehow detect that it's not streaming and tell it not to cache, I have no idea where it's coming from. If you kill gst-launch-1.0, Xorg goes back to normal

Rafostar commented 5 years ago

@thermatk gst-launch-1.0 should be automatically killed when streaming stops. According to your description it doesn't when you start streaming from another device while desktop streaming was active. Did I understood correctly? Does gst-launch-1.0 process disappears when streaming is stopped using stop button from gnome top bar remote?

thisbesonic commented 5 years ago

will the "cast-to-tv Desktop" also work via webbrowser?

My LG TV's miracast screen share does not work at all with miraclecast, so I thought this could be a solution via the tv inbuilt browser.

Rafostar commented 5 years ago

will the "cast-to-tv Desktop" also work via webbrowser?

My LG TV's miracast screen share does not work at all with miraclecast, so I thought this could be a solution via the tv inbuilt browser.

If your browser supports HTML5 and works with Cast to TV normally, which user Plyr web player, then it should work too. You can always test web support using demo video on Plyr website. Also browser should support video autostart, otherwise you must click play button quickly after page loads (cached data gets removed from memory and stream cannot start with missing headers).

Please note all the current bugs mentioned above and that lately I have been working on streaming core functionality which uses my other gst-rec terminal app (it creates web streams but doesn't come with web player). It is more mature as I hadn't time to move all improvements from it to desktop stream extension yet. Please check it out and see examples on its page (http server example might be useful to you).

deisi commented 4 years ago

So I had gnome-shell-extension-cast-to-tv working. Then I installed cast-to-tv-desktop-addon. Now Its not working any more and I see

Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: Restarting Cast to TV server
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: Started Cast to TV service
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: internal/modules/cjs/loader.js:775
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     throw err;
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     ^
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: Error: Cannot find module 'gstreamer-recorder'
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: Require stack:
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: - /home/malte/.local/share/gnome-shell/extensions/cast-to-tv-desktop-addon@rafostar.github.com/node_scripts/addon.js
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: - /home/malte/.local/share/gnome-shell/extensions/cast-to-tv@rafostar.github.com/node_scripts/addons-importer.js
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: - /home/malte/.local/share/gnome-shell/extensions/cast-to-tv@rafostar.github.com/node_scripts/bridge.js
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: - /home/malte/.local/share/gnome-shell/extensions/cast-to-tv@rafostar.github.com/node_scripts/server.js
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     at Function.Module._load (internal/modules/cjs/loader.js:677:27)
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     at Module.require (internal/modules/cjs/loader.js:830:19)
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     at require (internal/modules/cjs/helpers.js:68:18)
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     at Object.<anonymous> (/home/malte/.local/share/gnome-shell/extensions/cast-to-tv-desktop-addon@rafostar.github.com/node_scripts/addon.js:2:19)
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     at Module._compile (internal/modules/cjs/loader.js:936:30)
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     at Module.load (internal/modules/cjs/loader.js:790:32)
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     at Function.Module._load (internal/modules/cjs/loader.js:703:12)
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     at Module.require (internal/modules/cjs/loader.js:830:19) {
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:   code: 'MODULE_NOT_FOUND',
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:   requireStack: [
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     '/home/malte/.local/share/gnome-shell/extensions/cast-to-tv-desktop-addon@rafostar.github.com/node_scripts/addon.js',
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     '/home/malte/.local/share/gnome-shell/extensions/cast-to-tv@rafostar.github.com/node_scripts/addons-importer.js',
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     '/home/malte/.local/share/gnome-shell/extensions/cast-to-tv@rafostar.github.com/node_scripts/bridge.js',
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:     '/home/malte/.local/share/gnome-shell/extensions/cast-to-tv@rafostar.github.com/node_scripts/server.js'
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]:   ]
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: }
Aug 30 21:27:40 mtop org.gnome.Shell.desktop[1669]: Restarting Cast to TV server

all over my journalctl. If I see it correctly gstreamer-recorder is missing.

I'm on Arch Linux Gnome 3.32.2. Installed all addons from github current master branch. I have installed all gstream stuff I think. I'm using wayland.

Edit: Now i clicked the install npm modules button again and logged in under X11. However, now cast to tv doesn't even find the Chromecast any more, witch it was previously doing before clicking the install npm modules button

Edit: whohoo and now I got it to work. I think my mistake was, that I had installed and activated the cast-to-tv-desktop-addon but not clicked the install npm modules button > not working. Then I had turned off the cast-to-tv-desktop-addon and clocked install npm modules > not working. Only after I now restarted all the addons in the oder:

  1. gnome-shell-extension-cast-to-tv
  2. cast-to-tv-desktop-addon

and now it is finally working. So I guess my final comment here is. Its nice once it runs, but setting it up could be easier. Especially this ´install npm modules´ is really awkward and I tend to forget it. Also I have a delay of about 6 Seconds when doing screen sharing. It also runs just fine under X11 and Wayland for me.

Sidequestion, how do you control the cast once you started it. I currently use https://extensions.gnome.org/extension/1955/cast-control/

Rafostar commented 4 years ago

@deisi Glad to hear it works now (and even on Wayland). install npm modules step after enabling addons is necessary as it installs additional npm modules that this addon requires (I do not want to force users to install them if they wont be installing addons).

Sidequestion, how do you control the cast once you started it.

There should appear a widget to control the playback on gnome top bar. What source did you use to install gnome-extension (extensions page, git or arch package) and what version are you using (in settings about page)?

Edit: Also do you have gsettings installed (can you run it from terminal)? I'm not sure if Arch includes this bin by default.

deisi commented 4 years ago

do you have gsettings installed

gsettings is installed.

install npm modules step after enabling addons is necessary as it installs additional npm modules that this addon requires

Is there any use case for this addon if the modules are not installed?

What source did you use to install gnome-extension

I think for https://extensions.gnome.org/extension/1544/cast-to-tv/ I used the extension webpage and forcast-to-tv-desktop-addon I used the github repo.

Edit: I installed now also the cast-to-tv addon via github, but I still don't see the controls. Am I just too stupid to find them or could they really be missing.

Edit: aha and I found it now. Made a reboot and tada, ther is the Chromecast Remote thing :)

Rafostar commented 4 years ago

@deisi Glad it works. Can you also check casting desktop with sound? I posted instructions few posts above in this thread. And if you manage to find any other non-desktop streaming related problems, please open a separate github issue.

deisi commented 4 years ago

Okay, for today I'm too tired to try It now. I have put it on my list for tomorrow.

deisi commented 4 years ago

And now desktop cast is not working any more. I see this in my journalctl. Looks like a pipewire problem to me. Chromecast showing some connection things but then there is never any video. (rebot and reinstall of npm modules made no difference) alsa_output.pci-0000_00_1f.3.analog-stereo.monitor Video (with audio) cast is working. However I found out that the chromecast cant play VP9 videos. Is that correct? Isn't VP9 the thing google is trying to push to everybody and now they don't have it in their own stick?

Also I keep having trouble with the remote control. When ever the playback fails, the remote control vanishes. However the chromecast doesn't go back to its default desktop, but rather stays in some kind of pseudo playing state. Due to that I find my self using the https://extensions.gnome.org/extension/1955/cast-control/ addon all the time, because this doesn't go away.

Aug 31 11:47:52 mtop pipewire[4002]: [E][module-protocol-native.c:336 client_new()] no peersec: Protocol not available
Aug 31 11:47:52 mtop pipewire[4002]: [E][module-autolink.c:247 try_link_port()] module 0x55d5d21d4c40: can't link node 'No matching Node found'
Aug 31 11:47:55 mtop gnome-shell[1530]: Cast Control 2: GET Request Started to Cast API at http://localhost:3000/device
Aug 31 11:47:55 mtop gnome-shell[1530]: Cast Control 2: Now refreshed with API... waiting until next 15000ms
Aug 31 11:47:56 mtop pipewire[4002]: [E][module-protocol-native.c:336 client_new()] no peersec: Protocol not available
Aug 31 11:47:56 mtop pipewire[4002]: [E][module-autolink.c:247 try_link_port()] module 0x55d5d21d4c40: can't link node 'No matching Node found'
Aug 31 11:47:59 mtop pipewire[4002]: [E][module-protocol-native.c:336 client_new()] no peersec: Protocol not available
Aug 31 11:47:59 mtop pipewire[4002]: [E][module-autolink.c:247 try_link_port()] module 0x55d5d21d4c40: can't link node 'No matching Node found'
Aug 31 11:48:02 mtop pipewire[4002]: [E][module-protocol-native.c:336 client_new()] no peersec: Protocol not available
Aug 31 11:48:02 mtop pipewire[4002]: [E][module-autolink.c:247 try_link_port()] module 0x55d5d21d4c40: can't link node 'No matching Node found'

Edit: I switched back to X11 and now desktop cast is working. Audio however is not casted together with the video. I also checked if there is a new sink in pulseaudio, that is just not used, but I dont see any. I also tried to play a video and cast it via desktop cast. This wasn't working, as the video became green and was flickering even on my local screen. The same was shown on the TV.

Edit: My laptop just wen into standby while casting. The cast however did not end. It just kept showing the last image. Once I reactivated the laptop the cast just wen on.

Edit: Ups I didn't follow your instructions for audio setup correctly. Now it works. Sound and video are even synchronous.However videos show still a green flickering for me.

Edit: Videos played back via firefox and desktop cast work. Totem seems to be the ploblem here. Vlc works just fine with the same video.

Edit: I keept the desktop cast running for a little while. The delay becomes bigger and bigger. by now its about 30s. I tried to stop the cast with the remote control but it wont stop. Instead I had to use the remote control addon again.

Rafostar commented 4 years ago

@deisi Thanks for testing.

However I found out that the chromecast cant play VP9 videos. Is that correct?

Yes. Chromecast does not support VP9 nor h265. Only Chromecast Ultra supports them. See supported media here.

However the chromecast doesn't go back to its default desktop, but rather stays in some kind of pseudo playing state.

When Chromecast crashes it stays on black BG with cast logo. This is normal, ignore it. Just cast something other to get it to work again or wait a while and it will give up and go back to showing you colourful pictures.

Regarding errors. Only Wayland uses pipewire for desktop, X11 should work better, thats why I written on desktop-addon github page to use only X11 for now.

My laptop just wen into standby while casting.

I am not disabling standby in this extension (and I am not going to). If you have standby enabled either disable it or install some other extension like Caffeine to toggle it on/off.

the video became green and was flickering even on my local screen. The same was shown on the TV.

We are just recording screen and streaming it to TV. If it was green on your PC, then it is a problem with your video player.

The delay becomes bigger and bigger.

I need to add an option to reduce bitrate while streaming desktop, otherwise it grows due to video caching, that Google does not allow me to disable.

Rafostar commented 4 years ago

This thread is too long. We now have desktop streaming on a very preliminary stage. I know that it somehow works. Audio works too, but auto-enable needs to be integrated into extension.

I am closing this and strongly encourage to wait with desktop casting before I figure out how to resolve all the bugs that we were able to find in this thread.

Rafostar commented 4 years ago

If anyone is still interested in desktop streaming, then the relevant add-on for GNOME 3.34+ is now available on GNOME Extensions website: https://extensions.gnome.org/extension/2977/cast-to-tv-desktop-stream-add-on