8 ms·
How to send local files to Chromecast with Python
- atomi 8y agohttps://github.com/skorokithakis/catt https://github.com/skorokithakis/catt
- samspenc 8y agoWhen I read the original article, my first thought was: wow, someone could or should really build an interface on top of this that let's you cast all things. Looking at this GitHub project, looks like it lets you do exactly that.
- opencl 8y agoVLC also has similar functionality as of version 3.0.
- riku_iki 8y agoThere is also nice app: http://getvideostream.com/ http://getvideostream.com/
- sohkamyung 8y agoVLC also does transcoding of video formats that Chromecast does not support. For the python script, you have to ensure the video format is supported by Chromecast [1]. [1] https://developers.google.com/cast/docs/media https://developers.google.com/cast/docs/media
- sombremesa 8y agoYou can just cast anything using Chrome anyway...if you expand the dropdown in the top right there is a "Cast..." menu item right there.
- marcoperaza 8y agoThat's not the same. If websites don't implement a cast app themselves, then Chrome will just mirror the tab to the TV. Whereas catt and similar tools will actually direct the chromecast to download the video file directly and play it. This makes a big difference to quality and performance.
- sombremesa 8y agoSo what you're saying is that it's probably better to use a browser, because your bandwidth between your PC and your TV is likely to be much better, as well as having the capability to cast not only web content but also anything on your desktop. Plus a mirror is much easier to control, and some cast capable devices may not have the memory to "download" video files. What am I missing here? You seem to think it's a bad thing.
- jjaredsimpson 8y agoWhy would the bandwidth be better? I don't see a difference between a Chromecast making network requests or my PC doing it. Also casting your desktop is encoding the desktop. The quality is worse. The only advantage is for casting content with no native support.
- snowwindwaves 8y agosending a video stream from a file on your disk on a computer results in higher quality video on the television than playing a video in your browser and encoding a stream of your browser window and sending that to the chromecast to display on the TV.
- TylerE 8y agoYou're double encoding, and you're not saving bandwidth because you still have to download from the remote source. It's like one of those old FM adaptors for cars, or more pertinently - making a JPG of a GIF - everything gets worse.
- Spoom 8y ago
- StavrosK 8y agoYep, I had the same thought a while ago, which is why I built catt! It's come along very nicely, it works well and it's especially suitable if you run it as part of some automation (for example, you can make an Alexa skill to cast videos to your TV from various sources).
- dhruvkar 8y agoFantastic. Is there a library like this for Roku?
- mschuster91 8y agoInteresting. Is it known which libraries the Chromecast uses under the hood? Given that RCE exploits are commonplace for media/codec libraries, this can easily be used to get a decent jailbreak on the thing...
- kuschku 8y agoIt has been semi-jailbroken in the past, but Google has always very quickly closed anything. Chromecast (device, protocol, libraries, firmware) are Google’s most user-hostile and restrictive project so far.
- terminalcommand 8y agoChromecast even stops working if you do not have a working outside internet connection. On many occasions I've been unable to cast movies to chromecast simply because my internet connection was broken. After some time it bothered me that I had a machine plugged in 24/7 connected to both my local LAN and Internet, owned by Google. So, every night I unplug the chromecast and then plug it again whenever I want to cast something.
- bogle 8y agoIf physically disconnecting it is easy enough then I'd agree that is preferable. Only plug it in when required. How about creating a firewall rule and then toggling that instead of physically disconnecting the Chromecast? I found a likely configuration: https://blog.g3rt.nl/allow-google-chromecast-host-firewall-iptables.html#comment-2981801043 https://blog.g3rt.nl/allow-google-chromecast-host-firewall-i...
- untog 8y agoChromecast basically just uses Chrome under the hood. I imagine this tool is just creating a video tag.
- terminalcommand 8y agoAFAIK it is actually using a proprietary streaming protocol called CASTv2. It has been a community effort to reverse engineer the protocol and write implementations. Some useful links: https://github.com/vincentbernat/nodecastor https://github.com/vincentbernat/nodecastor // one of the earliest attempts of figuring out CASTv2 https://github.com/thibauts/node-castv2 https://github.com/thibauts/node-castv2 // one of the first libraries to support chromecast streaming based on the works of vincentbernat.
- xchaotic 8y agogenerally, you can cast anything from a Chrome browser tab, so just open those files in a new tab and cast away.
- wybiral 8y agoWhat about the opposite? Are there any good server libraries to cast content to as opposed to casting content from?
- jordanthoms 8y agoThis used to be possible, but IIRC Google locked things down and the cast receiver apps for Android stopped working.
- _ZeD_ 8y agoLook for miraclecast
- nsomaru 8y agoGreat. Casting is broken on Chromium from the Debian stretch stable repos.
- NicoJuicy 8y agoI'm using castnow, a cli in nodejs and has support for streaming torrents and local files https://github.com/xat/castnow https://github.com/xat/castnow Edit: from Python to nodejs
- terminalcommand 8y agoCastnow is great, but it is written in node.js not python.
- NicoJuicy 8y agoYou are right, i thought it had a dependency on Python (checked it in the past) and interpreted it as Python. While checking it, no idea where that came from.
- daveFNbuck 8y agoThis would be great if it worked. It's pretty simple, just pip install pychromecast and call pychromecast.get_chromecasts() in the repl. This returns an empty list for me every time.
- StavrosK 8y agoIs your Chromecast on the same subnet as your computer? If not, autodiscovery won't work.
- daveFNbuck 8y agoI believe so, it works for my browser and phone.
- zaptheimpaler 8y agoim pretty sure you can open chrome and just drag a local video into a tab and then chromecast the tab.
- Insanity 8y agoThe quality of doing that however, is not great
- keredson 8y agoa GUI that does exactly that (and the occasional transcoding / reboxing when necessary, to handle mkv files, etc.): https://github.com/keredson/gnomecast https://github.com/keredson/gnomecast
- FrenchyJiby 8y agoYey! Note that, much to my unhappiness (see issue #42) transcoding is a process that blocks the streaming from starting, which can take several minutes at 100% CPU.
- keredson 8y agoyeah, that's a sticky problem unfortunately. on the plus side real transcoding is pretty rare given h264 is pretty much everywhere now. most of the "transcoding" gnomecast does is repackaging an unmodified h264 stream from one container format to another, which FFMPEG can do at 30-100x (rather than 1-2x for real transcoding).
- Legogris 8y agoAnother alternative that worked pretty well for me with Linux: http://mkchromecast.com/ http://mkchromecast.com/
- trevordixon 8y agoI have http://movies.foamsnet.com/url/ http://movies.foamsnet.com/url/ bookmarked. Give it a URL, and it will send it to Chromecast and provide playback controls in your browser.
- spaceandshit 8y agoI'm surprised no one has mentioned Videostream! Works so smooth, and there's an iOS app so you don't need your computer for play back control. https://getvideostream.com/ https://getvideostream.com/ I also recently downloaded Soda Player for OSX to stream, and it also has similar capabilities.
- orf 8y ago+1 for videostream, it's an amazing app that I use almost daily. I paid for the premium version (playlists, download notifications etc) and it's well worth it.
- kojeovo 8y ago> so you don't need your computer .. which I have. Now I need an iOS device. Or set up a GET endpoint with the python library and access that from my mobile device of choice
- spaceandshit 8y agoI should have said mobile app. My TV is not in the same room as my computer setup, so it is more convenient for me to control with a smartphone.
- jgtrosh 8y agoYou can also control from the computer or an Android device
- wufufufu 8y agoVideoStream has also successfully played every filetype I've thrown at it. My only gripe is that it will lag on high bitrate videos (e.g. 9GB for a 2 hour long movie).
- bkovacev 8y agoI am using a tool called AirFlow - has built in support for subtitles which was the first thing I look for when chromcasting. Even though it's not free, it's an amazing tool. (not affiliated with them at all)
- Mrgir 8y agoDoes this also work with the Chromecast audio? and if not does anyone know of any great open tools for that hardware?
- LordDragonfang 8y agoIt looks like pychromecast implements the Google Chromecast API, so any Chromecast audio devices should show up in the list for pychromecast.get_chromecasts() https://github.com/balloob/pychromecast https://github.com/balloob/pychromecast
- Mrgir 8y agoNice, I'll have to try and play around with that to see if I can create some Sonos/Heos like functionality.
- epiphyte 8y agoI normally just use LocalCast (http://www.localcast-app.com/ http://www.localcast-app.com/), although there may be a use case for a kind of "jukebox" application using PyChromecast.
- kfir 8y agoSimpleHTTPServer is no longer part of python 3. On Python 3 this `python -m SimpleHTTPServer` should be `python -m http.server`
- emj 8y agopython2 will work for many years to come. python2 -m SimpleHTTPServer
- foxhop 8y agoWoah this is really, really cool! I've been meaning to mess with chromecast and this does all the heavy lifting for me! I think I'm going to wrap the script to get a REPL so that I don't loose access to the object, similar to what I did for AWS: https://github.com/russellballestrini/botoform/blob/master/botoform/plugins/repl.py https://github.com/russellballestrini/botoform/blob/master/b...
- mrguyorama 8y agoThis is awesome! I gave up on my hopes of doing custom stuff with my chromecast when I discovered there was a pricetag on the developer license, but this could be handy!