Use Your Command Line to Cast Almost Any Music or Video File Type
Using a combination of my phone, laptop, and an arsenal of apps and plugins, I can send pretty much anything to my Chromecast. However, nothing is ever perfect, and the file type that was still giving me headaches were torrent and magnet files.
Yes, I could download them to my phone or laptop and then cast them using any app I wanted, but the end result would be a lot of clutter and storage space used up for an episode I would only watch once.
CastNow, a command line utility by Reddit user xatxat, can handle pretty much any file type you throw at it. Since this is based off of the Node.js runtime, it can run on any Mac, Windows, or Linux computer that has node and npm commands installed.
If you do not have the Node.js runtime already installed on your computer, you can use the linked package files below to install it.
If you are using a Linux system, all you have to use is Terminal to install the necessary packages, using the following commands:
- sudo apt-get update
- sudo apt-get install nodejs
- sudo apt-get install npm
I will be using a Mac to perform this install, but don't worry, the same exact commands will work on Windows and Linux.
Now that you have the correct runtime to get CastNow started, you can copy over the install files. To do that, open up command prompt or Terminal window and issue the following command:
- git clone [https://github.com/xat/castnow.git
You'll know you did it right when you see the "Checking connectivity... done" message.
With the files in place, it's time to start the install process with the following command:
- npm install castnow -g
If that command gives you an error stating you need to try again as root or administrator, you will need to add the "sudo" prefix to it:
- sudo npm install castnow -g
Immediately after inputting that command, you will need to enter your password and confirm with the Enter key.
CastNow comes with plenty of options for getting content to your Chromecast, so use the following list to get the most out of your new plugin.
- Play a Local File: castnow ./[location.of.file]
- Play All Files in a Directory: castnow ./[Directory/]
- Play Multiple Videos: castnow [video1.mp4 video2.mp4 video3.mp4]
- Play Online Videos: castnow [videourl.mp4]
- Play a YouTube Video: castnow [youtubevideo.url]
- Play Multiple YouTube Vids in Succession: castnow [youtubevideo1.url] \ [youtubevideo2.url] \ [youtubevideo3.url]
- Play Torrent/Magnet Video or Audio Files: castnow <[url to torrent OR magnet file]>
If you ever find yourself disconnected from CastNow, you can reestablish the connection by typing "castnow" into a Terminal window.
While a video or song is playing, a timeline will display underneath the last command you entered. From that timeline, you can control the playback of your media.
- Spacebar: play/pause
- M: mute/unmute
- Up arrow: volume up
- Down arrow: volume down
- Left arrow: rewind
- Right arrow: forward
- N: next item in playlist
- S: Stop
- Q: Quit
There are few additional suffixes that can be added to a CastNow command which will allow for additional functionality:
- Transcode Unsupported Video Formats to MP4 (requires ffmpeg): --tomp4
- Select Which Chromecast to Cast To: --device [Chromecast Name]
- Hide Player Timeline: --verbose
Also, you can Add Subtitles to a Video with the following two commands.
- --subtitles [path to local subtitle file]
- --subtitles [url to subtitle file]
This may not be the prettiest option for casting, but if your aim is to keep your system as bloat-free and fast as possible, while also having the ability to cast nearly anything, this is definitely a Chromecast extension you need.
Let us know what you think of CastNow in the comment section below.