How To: Use Your Command Line to Cast Almost Any Music or Video File Type

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.

Step 1: Install Node.js

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.

Step 2: Clone the CastNow Repo

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 [

You'll know you did it right when you see the "Checking connectivity... done" message.

Step 3: Install CastNow

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.

Step 4: Cast Different File Types

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.

Step 5: Control the Playback

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

Additional Options

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.

Just updated your iPhone? You'll find new features for Podcasts, News, Books, and TV, as well as important security improvements and fresh wallpapers. Find out what's new and changed on your iPhone with the iOS 17.5 update.

Cover image modified from Shutterstock


One word. Plex. That will be all.


i just have 1 question, can we create a slideshow with this app?
Or just read .jpg ?

TY :)

So can this be used on a thumdrive or is it dependant on node or anything? I would like to just have some sort of .exe or something

anyway to have it autocast chrome(chromium) trying to have chrome auto cast to my tv on startup

Share Your Thoughts

  • Hot
  • Latest