112

I just saw the video about Chromecast and I am interested in knowing how can I enable this on my Ubuntu PC. My TV has an HDMI port.

10
  • 2
    Which video did you watch? Could you link to it in your question? Jul 26, 2013 at 20:27
  • None yet, but the addon did install (And I actually took my time to read the information about "How to use Chromecast) which I accidentally skipped yesterday. Was too tired). When I get the chance to test it with a device I will let you know immediately. Jul 26, 2013 at 20:39
  • ok. I just thought that you had a specific video in mind that would be useful for others. I've found a few for my own edification. Cheers! Jul 26, 2013 at 22:39
  • 1
    Many options and work-arounds are posted here including a now deprecated Chromium extension and several reports that the functionality has been added to Chrome and Chromium and therefore available by default. I think we're losing track of the main question. Should I buy a Chromecast to use with Ubuntu? Answer: No. Chromecast does not currently work with Ubuntu out of the box. There may be some suggested work-arounds, but the fact remains. It's not supported by Google or anyone on the Ubuntu side. It doesn't work out of the box and there's nobody working to make sure any unrelated changes don't
    – jorfus
    Oct 1, 2018 at 19:54
  • 1
    After the merge of this PR will add Chromecast support to GND (Gnome Network Displays) Apr 24, 2023 at 13:32

13 Answers 13

89

The documentation from Google indicates that the Google Cast extension is not supported in Linux, but it actually does work.

To get this working in Ubuntu:

  • Make sure you are running either Chromium or Chrome version 28 or higher. Earlier versions will get a "This application is not supported on this computer. Installation has been disabled." error. The 'chromium-browser' package in Ubuntu 13.04 works fine.

  • Make sure iptables is configured to allow the UPnP/SSDP traffic used by the Google Cast browser extension to discover the ChromeCast device.

    The browser will send a multicast UDP packet from the local IP and an ephemeral (random) port to 239.255.255.250 port 1900. The ChromeCast device will respond with a unicast UDP packet from the ChromeCast device's IP and another ephemeral port to the source IP/port of the multicast packet. Note that this is slightly different than most other UPnP devices, which will usually respond with a unicast UDP packet from port 1900 instead of an ephemeral port.

    The typical iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT rule WILL NOT match the response packet, as iptables does not currently have a conntrack helper that supports SSDP. In addition, the iptables -A INPUT -p udp --sport 1900 -j ACCEPT rule typically used for UPnP/SSDP will not work since the replies from the ChromeCast device do not come from port 1900.

    Therefore, you will need to add a rule to accept UDP packets on all ephemeral ports. The ephemeral port range for the initial multicast packet should be 32768-61000 (Verify with cat /proc/sys/net/ipv4/ip_local_port_range), so the following rule should work (note it inserts at the top of the input rules):

    iptables -I INPUT -p udp -m udp --dport 32768:61000 -j ACCEPT

    After the ChromeCast device has been discovered (each time the browser starts), the browser will control it using TCP (HTTP) connections to port 8008, which should not require any special iptables rules.

  • Install the Google Cast browser extension in either Chromium or Chrome. Note that an app/extension called ChromeCast is available, but this is not what you want.

  • If you have not yet set up your ChromeCast device, follow the instructions that come with the device to set it up.

  • Once your device is configured, you should be able to simply click the Cast button in Chromium to Cast your current tab.

9
  • 2
    Thanks for the info on IP tables. I wasn't aware of Chromecast's different behavior from other uPnP devices. Aug 24, 2013 at 23:15
  • 1
    To get this solution to work in Fedora using the GUI, go to the Zones tab in "Firewall configuration", select the public zone, go to the ports tab, and add the udp port range 32768-61000
    – CamelBlues
    Jun 20, 2014 at 1:07
  • Sadly, this does not work for Nexus Player.
    – abergmeier
    Feb 3, 2015 at 19:17
  • The castv2 protocol seems to use mDNS + Cast(s) protocol on port 8009 instead of the original approach. Additionally, when Mirroring your screen it will send traffic on a separate UDP port for the screen data which is announced dynamically during the handshake. Sep 13, 2015 at 14:13
  • 3
    All this is no longer necessary as of current Chrome/Chromium versions. Jun 28, 2018 at 0:10
42

This answer no longer works because the extension has been discontinued; this answer is, however, being left as-is for historical reasons.

It looks as if all you need is the browser Chrome or Chromium and the extension below: https://chrome.google.com/webstore/detail/google-cast/boadgeojelhgndaghljhdicfkmllpafd

9
  • 1
    google said you need android 4.3, win, iphone or chromebook but I think this extension may work in linux Jul 25, 2013 at 15:32
  • 2
    I have added it to Chromium - I will try to get hold of a Chromecast, test it and get back to you
    – azra
    Jul 25, 2013 at 17:09
  • 1
    please share your results here (and if you can please do a test with Chrome also) Jul 26, 2013 at 8:38
  • 4
    When I try to install the extension on Ubuntu 13.04 and Chrome 26.0.1410.63, the extension's page says, "This application is not supported on this computer. Installation has been disabled." Nobody else is getting that message?
    – Sam Swift
    Jul 27, 2013 at 17:56
  • 5
    This extension has been discontinued.
    – richardaum
    Mar 15, 2017 at 12:36
19

pulseaudio-dlna

This project is in active development. From version >= 0.4.6 Chromecast is supported in addition to DLNA.

From Ubuntu >=16.10 pulseaudio-dlna is in the Universe repository.

For older versions the ppa ppa:qos/pulseaudio-dlna needs to be added first:

sudo apt-add-repository ppa:qos/pulseaudio-dlna
sudo apt-get update

We can then install pulseaudio-dlna it with:

sudo apt-get install pulseaudio-dlna

It then can be run from a terminal or script with

pulseaudio-dlna [options]

It will add all DLNA and Chromecast client(s) available in the local network as an audio output device to select from the sound settings menu.

We can then stream the audio from any media player (or browser) to our Chromecast client.

For all options see the project's documentation at GIT.

5
  • Little command added =)
    – A.B.
    Dec 4, 2015 at 19:19
  • second step should be sudo apt-get update, something obvious for most of us, but maybe some users face it ;-)
    – wikier
    Dec 7, 2015 at 13:35
  • cool, thx for upgrading the answer :+1:
    – wikier
    Dec 10, 2015 at 8:13
  • Nice, working out of the box, although stuttering a bit from time to time... thanks, +1
    – Rmano
    Feb 20, 2016 at 17:30
  • Package pulseaudio-dlna is not available, but is referred to by another package. (Ubuntu 20.4) What to do then?
    – Thomas
    Oct 25, 2020 at 20:51
7

Since this question was asked 2 years ago, it may be worth mentioning that after Feb 2016, on Xubuntu 15.10, it was as easy as:

  1. Install Chrome or Chromium for Linux
  2. Install the Google Cast browser extension from within Chrome

Cast the tab you want. Easy as that.

EDIT: Now the feature is built in:

screenshot

5
  • 4
    This extension has been discontinued.
    – richardaum
    Mar 15, 2017 at 12:36
  • 5
    Because the functionality is now built in Mar 20, 2017 at 14:45
  • 2
    built in to what? I'm on a fresh install of 17.04, install chromium, extensions imported from my account. Can't see the chrome cast device :(
    – Madivad
    May 15, 2017 at 11:19
  • I'm running 16.04, fresh chrome and chromium, firewall stopped, no option to cast.
    – jorfus
    Oct 1, 2018 at 17:53
  • Chrome 81 in Ubuntu 19.10 has Cast menu item and lists the "[TV] Samsung 7 Series (50)" item, but non-YouTube tabs say "Source not supported". May 1, 2020 at 15:03
5

I'm running Ubuntu 14.04 on my PC & Android 4.3 on my Phone.

First you need to plug the Chromecast in and change the TV source to that HDMI port.

Next install the Phone app from here on play store

Then use the Phone app to connect the Chromecast to your wifi and then it will update and reboot.

After that, go to your Ubuntu PC and open Chromium and install this app from the Chrome web store The Chrome-cast device is now listed. It's that simple.

For video file playback : Go to File > Open File locate the video and open. The Chromium browser has a media player built in. Then you can stream it. Remember to go "full screen" (press F11) :) That's it.

Here are the codecs that work in Chromium : http://www.chromium.org/audio-video

There are other projects like VLC or XBMC that are working on Chromecast compatability, so it won't be long until we can stream everything. If you use Steam you can install VLC or XBMC and stream from one Steam box to another already.

2
  • Can we add subs to this build in player? Vlc chromecast suppor only in windos for now. Dec 21, 2016 at 17:59
  • I have not yet bought or tried Chromecast-2. If VLC do not support Chromecast for now, can 3D- HSBS movies be played through Bino, or SMPlayer to cast on TV? Jan 2, 2018 at 18:26
4

I just got my chromecast device. It can stream YouTube and tabs from Chrome. Because Netflix is not available on Ubuntu you cannot stream movies from Ubuntu. Tab streaming gives you a lot of cool features. I already tried: streaming photos from Flickr, streaming videos from Vimeo, streaming music from SoundCloud or Google Music (I connected it to Receiver, so experience is awesome).

I did not see any issues with music streaming, but in video you can see some dropped frames (but not really, I watched some imdb.com trailers and overall it was fine).

I could not make Chrome with Chromecast play avi files from my local PC. It allows to stream it, but I see black screen on TV (I guess this is not supported).

And I did not do anything special to install Chromecast plugin on Chrome, it just works.

2
  • It only works if you have your firewall turned off :-( Can others confirm? Aug 17, 2013 at 18:04
  • Does this work to cast 3D HSBS movies through players like Bino or SMPlayer? If yes, then only I would buy the Chromecast-2. Jan 2, 2018 at 18:31
3

You need Google Cast server app on the Ubuntu based PC or your NAS.

Chromecast device is new...
The question is: "Does this app exist yet?" It is a new opportunity for Linux developers.

More info on the Google developers page

2
  • 5
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Jul 29, 2013 at 21:40
  • I tried to install mkchromecast.com on my 14.04.3 LTS system, but it did not work. Report on Package Installer :"Status : Error: Dependency is not satisfiable: python3-pychromecast." Jan 2, 2018 at 18:46
3

This was tested using Ubuntu 18.04+

There are several ways of sharing and streaming using either Chromecast or Chromecasr Ultras:

  1. Using Google Chrome with the Videostream App)
  2. Using SMPlayer or VLC, both of which have the option to Stream to Chromecast

SMPlayer enter image description here

VLC enter image description here

  1. Using Youtube (In Google Chrome):

enter image description here

This helps a lot when you are managing multiple rooms, kids, NetFlix accounts and more. Do note that if Chromecast is not detected, 99% of the time is the network configuration. You can find a lot of helpful advice at the Chromecast Help Page or going to the Troubleshooting Guide.

You can also share your desktop by using the Cast option in Google Chrome:

enter image description here

And after selecting any of the Chromecasts you would see something like this:

enter image description here

3

mkchromecast

sudo apt install mkchromecast
mkchromecast --video -i "~/Videos/Example.mkv"

Reference

3

Chromium Version 70.0.3538.77 (Official Build) Built on Ubuntu, running on Ubuntu 18.04 (64-bit)

https://support.google.com/chromecast/answer/3228332?co=GENIE.Platform%3DDesktop&hl=en

enter image description here

enter image description here

0
2

I just recently managed to get my chromecast working with Chrome in Ubuntu, quite simply, I added the device with my mobile phone, and it magically appeared in Chrome in Ubuntu.

1
  • Is your firewall off?
    – jorfus
    Oct 1, 2018 at 17:54
1

Simply click the Chrome Tools menu in the top right corner of your Chrome browser window. Then click Cast… More detail from google support

0

With firewalld I had just to open a port range in your current zone:

firewall-cmd --get-active-zones
work
    interfaces: wlp0s20f3

In this case the zone is work.

firewall-cmd --permanent --zone=work --add-port=32768-61000/udp
firewall-cmd --reload

After this, chromecast worked without problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .