Home

Awesome

castnow

Castnow is a command-line utility that can be used to play back media files on your Chromecast device. It supports playback of local video files, videos on the web and torrents. You can also re-attach a running playback session (this sentence should belong somewhere else).

Interested in being a castnow maintainer?

I currently don't have that much time to maintain this project and have also lost some interest (to be honest). Main reason is that we have had a new TV for a few months that supports casting directly to it using DLNA (you may wanna checkout dlnacast). Feel free to contact me ( simon@sope.io ) if you want to be added as a maintainer to castnow.

Install

sudo npm install castnow -g

Usage


// start playback of a local video file
castnow ./myvideo.mp4

// start playback of video and mp3 files in the local directory
castnow ./mydirectory/

// playback 3 videos after each other
castnow video1.mp4 video2.mp4 video3.mp4

// start playback of an mp4 file over the web
castnow http://commondatastorage.googleapis.com/gtv-videos-bucket/ED_1280.mp4

// start playback of a video over torrent
castnow <url-to-torrent-file OR magnet>

// start playback of a video over torrent with local subtitles
castnow <url-to-torrent-file OR magnet> --subtitles </local/path/to/subtitles.srt>

// transcode some other video format to mp4 while playback (requires ffmpeg)
castnow ./myvideo.avi --tomp4

// transcode only audio while playback (in case the video shows, but there's no audio)
castnow ./myvideo.mkv --tomp4 --ffmpeg-vcodec copy

// change the increment at which the volume steps up or down. A lower number
// is helpful if your speakers are very loud, and you want more precision over
// the change in volume
castnow ./song.mp3 --volume-step "0.01"

// re-attach to a currently running playback session
castnow

Options

Optionally, options can be preset by storing them in a file named .castnowrc in the current user's home directory. For example:

--myip=192.168.1.8
--volume-step=0.01

Player Controls


space   // toggle between play and pause
m       // toggle mute
t       // toggle subtitles
up      // volume up
down    // volume down
left    // seek backward (keep pressed / multiple press for faster seek)
right   // seek forward (keep pressed / multiple press for faster seek)
n       // next item in the playlist (only supported in launch-mode)
s       // stop playback
q       // quit

YouTube Support

We had to drop direct YouTube support for now since google changed the chromecast YouTube API. However, there is a nice workaround in combination with the tool youtube-dl:

youtube-dl -o - https://youtu.be/BaW_jenozKc | castnow --quiet -

Thanks to trulex for pointing that out.

Non-Interactive

Castnow can also be used in cron jobs or via window-manager bindings; for example:

// Play/pause.
castnow --command space --exit

// Louder.
castnow --command up --exit

Usage via screen command

To avoid starting a new castnow command every time (which takes long time) you should use background sessions.

// run castnow in backgound only once:
screen -d -m -S cast_session castnow /path/to/mp3/

// use the running session:
// Play/pause.
screen -S cast_session -X stuff ' '

// Mute.
screen -S cast_session -X stuff 'm'

// Subtitles.
screen -S cast_session -X stuff 't'

// Volume up.
screen -S cast_session -X stuff $'\e[A'

// Volume down.
screen -S cast_session -X stuff $'\e[B'

// Seek backward.
screen -S cast_session -X stuff $'\e[D'

// Seek forward.
screen -S cast_session -X stuff $'\e[C'

// Next item in the playlist.
screen -S cast_session -X stuff 'n'

// stop playback.
screen -S cast_session -X stuff 's'

// quit/stop session
screen -S cast_session -X stuff 'q'
// or
screen -S cast_session -X quit

reporting bugs/issues

Please include the debug output in your issues. You can enable the debug messages by setting the DEBUG environment variable before running the castnow command like this: DEBUG=castnow* castnow ./myvideo.mp4. Some problems have already been addressed in our wiki https://github.com/xat/castnow/wiki.

contributors

License

Copyright (c) 2015 Simon Kusterer

Licensed under the MIT license.