Caster - Command-line control for ChromeCast
Java
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
libs
receiver
src/com/entertailion/java/caster
.classpath
.project
README.md

README.md

Caster

Caster is a command-line application to beam video files to ChromeCast devices. It is useful for automation and scripting use cases.

To run the application, you need a Java runtime environment (JRE) for your operating system.

There is a dependency on a web app that needs to be registered with Google.

Caster provides several command line options which are self-documented with the '-h' option:

java -jar caster.jar -h
usage: java -jar caster.jar [-d <arg>] [-f <arg>] [-h] [-id <arg>] [-l] [-r]
       [-rp <arg>] [-s] [-t] [-tp <arg>] [-v] [-V]
  -d,--device <arg>                 ChromeCast device IP address
  -f,--file <arg>                   Local media file; -d also required
  -h,--help                         Print this help message
  -id,--app-id <arg>                App ID for whitelisted device
  -l,--list                         List ChromeCast devices
  -r,--rest                         REST API server
  -rp,--rest-port <arg>             REST API port; default 8080
  -s,--stream                       HTTP URL for streaming content; -d also required
  -t,--transcode                    Transcode media; -f also required
  -tp,--transcode-parameters <arg>  Transcode parameters; -t also required
  -v,--verbose                      Verbose debug logging
  -V,--version                      Print version information

Here are some examples of using Caster:

  • Get the list of ChromeCast devices (there is a 10 second delay for finding the devices on the local network):
    java -jar caster.jar -l
  • Play a stream from the internet on the ChromeCast device with IP address 192.168.0.22:
    java -jar caster.jar -d 192.168.0.22 -s "http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4"
  • Play a local file:
    java -jar caster.jar -d 192.168.0.22 -f "/Users/leon_nicholls/Downloads/video.mp4"
  • Transcode a local file:
    java -jar caster.jar -d 192.168.0.22 -t -f "/Users/leon_nicholls/Downloads/video.wmv"
  • Transcode a local file with custom VLC transcoding parameters:
    java -jar caster.jar -d 192.168.0.22 -t -tp "vcodec=VP80,vb=2000,vfilter=canvas{width=640,height=360}, acodec=vorb,ab=128,channels=2,samplerate=44100,threads=2" -f "/Users/leon_nicholls/Downloads/video.wmv"
  • Start the REST API server on the default port 8080:
    java -jar caster.jar -r

When the REST API server is launched, Caster will keep running and will not exit as with all the other command-line options. The REST API server supports HTTP GET and POST operations to query and control media playback. Here are the HTTP requests supported:

ChromeCast devices only support a limited number of media formats. Caster has experimental support for converting other media formats into WebM using the vlcj library for VLC. You need to download and install VLC for your computer (the latest 64-bit version is preferred). For Windows, you need to install the 64-bit experimental version. If you have the 64-bit version of Java, you have to install the 64-bit version of VLC. By default Caster uses the following VLC transcoding parameters:

:sout=#transcode{vcodec=VP80,vb=1000,vfilter=canvas{width=640,height=360}, acodec=vorb,ab=128,channels=2,samplerate=44100,threads=2} :http{mux=webm,dst=:8087/cast.webm} :sout-keep
Note that converting video is very CPU intensive. It might take several seconds for the video to start playing on your ChromeCast device.

The computer running the Caster application needs to be on the same network as the ChromeCast device. To play the video, a web server is created on port 8080 on your computer and you might have to configure your firewall to allow incoming connections to access the video.

Caster doesn't provide command-line playback controls. You can use an Android app like RemoteCast to remotely control the media playback.

Note for developers: You need to put your own app ID in the Main.java and receiver index.html files. Upload the receiver index.html file to your whitelisted app URL. Generate the caster.jar file from the source code. This caster.jar build can be used with your own "-id" app id as a command-line parameter.

Other apps developed by Entertailion: