• Stars
    star
    3,810
  • Rank 11,553 (Top 0.3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

commandline chromecast player

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 ( [email protected] ) 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

  • --tomp4 Transcode a video file to mp4 during playback. This option requires ffmpeg to be installed on your computer. The play / pause controls are currently not supported in transcode mode.

  • --device "my chromecast" If you have more than one Chromecast on your network, use the --device option to specify the device on which you want to start casting. Otherwise, castnow will just use the first device it finds in the network.

  • --address 192.168.1.4 The IP address or hostname of your chromecast. This will skip the MDNS scan.

  • --subtitles <path/URL> This can be a path or URL to a vtt or srt file that contains subtitles.

  • --subtitle-scale 1.5 Scaling factor for the size of the subtitle font. Default is 1.0.

  • --subtitle-color #FFFFFFFF Foreground RGBA color of the subtitle font.

  • --myip 192.168.1.8 Your main IP address (useful if you have multiple network adapters)

  • --quiet Hide the player timeline.

  • --peerflix-<option> <argument> Pass options to peerflix.

  • --ffmpeg-<option> <argument> Pass options to ffmpeg.

  • --type <type> Explicity set the mime-type of the first item in the playlist (e.g. 'video/mp4').

  • --seek <hh:mm:ss> Seek to the specified time on start using the format hh:mm:ss or mm:ss.

  • --bypass-srt-encoding Disable automatic UTF-8 encoding of SRT subtitles.

  • --loop Play the list of files over and over in a loop, forever.

  • --shuffle Play the list of files in random order.

  • --recursive List all files in directories recursively.

  • --volume-step Step at which the volume changes. Helpful for speakers that are softer or louder than normal. Value ranges from 0 to 1. Default is 0.05.

  • --command <key1>,<key2>,... Execute key command(s) (where each <key> is one of the keys listed under player controls, below).

  • --exit Exit when playback begins or --command <key> completes.

  • --help Display help message.

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.

More Repositories

1

dlnacast

Cast local media to your TV through UPnP/DLNA
JavaScript
286
star
2

react-component-composition-cheatsheet

React component composition cheatsheet
185
star
3

chromecast-player

simple chromecast player
JavaScript
99
star
4

airtar

send files over the local network using airpaste and tar
JavaScript
91
star
5

limits.js

limits.js helps you to handle API limitations
JavaScript
54
star
6

webcam-binaryjs-demo

Webcam Binary.JS Demo
HTML
32
star
7

torrentcast

raspberry pi torrentcast
JavaScript
27
star
8

chromecast-scanner

scan your local network for chromecast devices and return the first found
JavaScript
27
star
9

Bucket-Balls

Turn your devices into buckets. Impress your friends with "magic" :-)
JavaScript
20
star
10

castv2-youtube

castv2-client youtube sender
JavaScript
20
star
11

finance-stream

realtime stock and exchange stream
JavaScript
15
star
12

hls-chromecast-demo

transcode video and stream it to chromecast on the fly
JavaScript
13
star
13

chromecast-can-play

Check if a certain media file is supported by Chromecast
JavaScript
10
star
14

omxctrl

simple omxplayer wrapper for node
JavaScript
7
star
15

ago

create time templates
JavaScript
6
star
16

lastreturn

get the last return value of a function as argument in the next call
JavaScript
6
star
17

playerui

minimalistic mediaplayer commandline ui
JavaScript
6
star
18

jQuery-DropIt

Lets you drop HTML snippets and images into your html document
JavaScript
5
star
19

lu.js

lightweight dependency injection lib written in JavaScript.
JavaScript
3
star
20

csseval

use expressions to evaluate css on the fly.
JavaScript
3
star
21

co-limits

limits.js version that can be used with co
JavaScript
3
star
22

contao-customselectmenu

Select-Menu with an additional last option 'other value'.
PHP
3
star
23

queryExtend

Like _.extend, just for URL queries.
JavaScript
2
star
24

contao-hooky

Triggering callbacks in Contao made easy
PHP
2
star
25

notify-php

A PHP Class for sending JSON-RPC Notifications
PHP
2
star
26

sope.js

minimalstic javascript boot library
JavaScript
2
star
27

notify-bridge

JSON-RPC notification bridge
JavaScript
2
star
28

contao-rpc

RPC Framework for Contao
PHP
2
star
29

contao-rpc-example

Usage Example for Contao-RPC
PHP
1
star
30

jQuery-bgScroll

Fullscreen Background with up- and down animation
JavaScript
1
star
31

upm-install

atlassian cloud add-on installer
JavaScript
1
star
32

keyval

evented key/value storage lib
JavaScript
1
star
33

understanding-koa

Some koa samples
JavaScript
1
star
34

lambda-compose

lambda-compose adds middleware and promise support to your lambda functions.
JavaScript
1
star
35

node-asin-queue

JavaScript
1
star
36

timeline

another generic timeline module
JavaScript
1
star
37

allow-request

whitelist certain http routes
JavaScript
1
star
38

filteramo

elasticsearch for the poor man
JavaScript
1
star
39

circulate

circulate over an javascript array
JavaScript
1
star
40

jQuery-quoteFade

jQuery plugin which lets you simply loop through a bunch of items with a fade-effect.
JavaScript
1
star
41

fleet

Manage a fleet of Confluence instances with ease
JavaScript
1
star
42

notify-contao

Send push notifications from the contao to the frontend
PHP
1
star