GithubHelp home page GithubHelp logo

anirudha-banerjee / cast-to-tv-desktop-addon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rafostar/cast-to-tv-desktop-addon

0.0 0.0 0.0 1.8 MB

Desktop streaming support for GNOME Shell Extension Cast to TV.

License: GNU General Public License v2.0

Makefile 9.23% JavaScript 90.77%

cast-to-tv-desktop-addon's Introduction

Cast to TV Desktop Stream Add-on

Desktop streaming support for GNOME Shell Extension Cast to TV v14+.

Comparison with Chrome desktop streaming

  • Pros:
    • Streams with audio
    • Works on Wayland
    • Customizable video bitrate and fps
    • Hardware acceleration
    • Option to show/hide mouse cursor
  • Cons:
    • Higher delay

Requirements

Desktop streaming uses PulseAudio to capture sound and pacmd to alter its configuration, so your system must be using them (most Linux distros do by default).

If you want to use VAAPI hardware acceleration, you have to additionally install gstreamer1-vaapi plugins. Nvidia hardware acceleration is included as part of plugins-bad package.

Remember to select correct AAC plugin in extension preferences. Support varies by Linux distro. You can check which one you have from terminal using gst-inspect-1.0:

gst-inspect-1.0 fdkaac
gst-inspect-1.0 faac
gst-inspect-1.0 avenc_aac
gst-inspect-1.0 voaacenc

Fedora

Having enabled rpm fusion repos run:

sudo dnf install gstreamer1-plugins-{base,good,bad-free,ugly}

Download

Installation from source code

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

After installing restart gnome-shell and enable the newly added extension using GNOME Tweaks.

Before using this Add-on you also must install some additional npm packages.
Go to Cast Settings -> Modules and click Install npm modules button.
This step will install additional packages and automatically restart Cast to TV server.

Audio fix

In order to automatically switch audio output to the receiver, we need to alter PulseAudio default config a little. Open /etc/pulse/default.pa in any text editor as root and find line with:

load-module module-stream-restore

Change it into below and save edited file:

load-module module-stream-restore restore_device=false

Finally for the changes to take effect restart PulseAudio with below command or reboot:

pulseaudio -k

Hardware acceleration

The add-on allows using either VAAPI (Intel/AMD) or NVENC (Nvidia) hardware accelerated recording (disabled by default).

Unfortunately GStreamer implementation of both is kind of experimental state right now. Using it might crash your gnome-shell session. Please be warned. If you wish to try it anyway, you might need to enable it by adding LIBVA_DRIVER_NAME= with correct driver name and GST_VAAPI_ALL_DRIVERS=1 to your /etc/environment (Intel/AMD), if you are on Nvidia check if your gstreamer build was compiled with nvenc support.

GStreamer pipeline

Above graph shows currently used GStreamer pipeline during streaming.

Please note that GNOME Shell does not let you see or edit video capture part (besides only few options), so the beggining of video stream shown here was replaced with VideoTestSrc + CapsFilter.

VideoRate element is required, because GNOME Recorder uses variable framerate for screen capture which Chromecast does not like.

MultiQueue element for all branches is recommended for h264 encoding according to GStreamer docs.

To do

  • Implement desktop recording using GNOME Shell.Recorder
  • Audio support
  • Video scaling
  • Add video bitrate and fps setting
  • Support HLS and TCP stream
  • Auto switching of audio sink
  • Hardware acceleration (vaapi/nvenc)
  • Wayland support
  • Native audio sink selection in GJS

cast-to-tv-desktop-addon's People

Contributors

logix2 avatar rafostar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.