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:
- List devices (HTTP GET: /devices):
curl -i -X GET http://192.168.0.50:8080/devices
With a JSON array response:[{"ip_address":"192.168.0.22","name":"Living Room"}]
- Playback status (HTTP GET: /playback):
curl -i -X GET http://192.168.0.50:8080/playback?device=192.168.0.22
With a JSON object response (state value can be "idle", "playing" or "stopped"):{"duration":27,"time":12,"state":"playing"}
- Play stream (HTTP POST: /playback):
curl -i -X POST -d "device=192.168.0.22&stream=http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4" http://192.168.0.50:8080/playback
- Play file (HTTP POST: /playback):
curl -i -X POST -d "device=192.168.0.22&file=/Users/leon_nicholls/Downloads/video.mp4" http://192.168.0.50:8080/playback
- Transcode file (HTTP POST: /playback):
curl -i -X POST -d "device=192.168.0.22&file=/Users/leon_nicholls/Downloads/video.wmv&transcode=true" http://192.168.0.50:8080/playback
- Transcode file with custom VLC URL encoded transcoding parameters (HTTP POST: /playback):
curl -i -X POST -d "device=192.168.0.22&file=/Users/leon_nicholls/Downloads/video.wmv&transcode=true&transcode-parameters=vcodec%3DVP80%2Cvb%3D2000%2Cvfilter%3Dcanvas%7Bwidth%3D640%2Cheight%3D360%7D%2C+acodec%3Dvorb%2Cab%3D128%2Cchannels%3D2%2Csamplerate%3D44100%2Cthreads%3D2" http://192.168.0.50:8080/playback
- Pause playback state (HTTP POST: /playback):
curl -i -X POST -d "device=192.168.0.22&state=pause" http://192.168.0.50:8080/playback
- Play playback state (HTTP POST: /playback):
curl -i -X POST -d "device=192.168.0.22&state=play" http://192.168.0.50:8080/playback
- Stop playback state (and close app) (HTTP POST: /playback):
curl -i -X POST -d "device=192.168.0.22&state=stop" http://192.168.0.50:8080/playback
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-keepNote 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:
- Fling: GUI to beam video files from computers to ChromeCast devices.
- DIAL: ChromeCast device discovery and YouTube playback.
- Able Remote for Google TV: The ultimate Google TV remote
- Open Launcher for Google TV: The ultimate Google TV launcher
- Overlay for Google TV: Live TV effects for Google TV
- Overlay News for Google TV: News headlines over live TV
- Video Wall: Wall-to-Wall Youtube videos
- GTV Tasker Plugin: Control your Google TV with Tasker actions