├── .classpath ├── .project ├── .settings ├── org.eclipse.core.resources.prefs └── org.eclipse.jdt.core.prefs ├── README.md ├── libs ├── commons-cli-1.2.jar ├── commons-logging-1.1.1.jar ├── httpclient-4.2.5.jar ├── httpcore-4.2.4.jar ├── java_websocket.jar ├── jna-3.5.2.jar ├── json-simple-1.1.1.jar ├── platform-3.5.2.jar └── vlcj-2.4.1.jar ├── receiver └── index.html └── src └── com └── entertailion └── java └── caster ├── AppHandler.java ├── BroadcastAdvertisement.java ├── BroadcastDiscoveryClient.java ├── BroadcastDiscoveryHandler.java ├── BroadcastHandler.java ├── DeviceFinder.java ├── DeviceFinderListener.java ├── DialServer.java ├── EmbeddedServer.java ├── HttpRequestHelper.java ├── HttpServer.java ├── Log.java ├── Main.java ├── Platform.java ├── Playback.java ├── PlaybackListener.java ├── RampClient.java ├── RampWebSocketClient.java ├── RampWebSocketListener.java ├── TrackedDialServers.java └── WebListener.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Caster 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | #Mon Sep 02 18:50:19 CDT 2013 2 | eclipse.preferences.version=1 3 | encoding//src/com/entertailion/java/caster/Main.java=UTF-8 4 | encoding//src/com/entertailion/java/caster/Playback.java=UTF-8 5 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | #Wed Aug 28 15:42:28 CDT 2013 2 | eclipse.preferences.version=1 3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.6 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.source=1.6 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Caster 2 | ====== 3 | 4 |

5 | 6 |

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

7 | 8 |

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

9 | 10 |

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

11 | 12 | Caster provides several command line options which are self-documented with the '-h' option: 13 | ``` 14 | java -jar caster.jar -h 15 | usage: java -jar caster.jar [-d ] [-f ] [-h] [-id ] [-l] [-r] 16 | [-rp ] [-s] [-t] [-tp ] [-v] [-V] 17 | -d,--device ChromeCast device IP address 18 | -f,--file Local media file; -d also required 19 | -h,--help Print this help message 20 | -id,--app-id App ID for whitelisted device 21 | -l,--list List ChromeCast devices 22 | -r,--rest REST API server 23 | -rp,--rest-port REST API port; default 8080 24 | -s,--stream HTTP URL for streaming content; -d also required 25 | -t,--transcode Transcode media; -f also required 26 | -tp,--transcode-parameters Transcode parameters; -t also required 27 | -v,--verbose Verbose debug logging 28 | -V,--version Print version information 29 | 30 | ``` 31 | 32 |

Here are some examples of using Caster: 33 |

    34 |
  • Get the list of ChromeCast devices (there is a 10 second delay for finding the devices on the local network): 35 |
    36 | java -jar caster.jar -l 37 |
    38 |
  • 39 |
  • Play a stream from the internet on the ChromeCast device with IP address 192.168.0.22: 40 |
    41 | java -jar caster.jar -d 192.168.0.22 -s "http://commondatastorage.googleapis.com/gtv-videos-bucket/big_buck_bunny_1080p.mp4" 42 |
    43 |
  • 44 |
  • Play a local file: 45 |
    46 | java -jar caster.jar -d 192.168.0.22 -f "/Users/leon_nicholls/Downloads/video.mp4" 47 |
    48 |
  • 49 |
  • Transcode a local file: 50 |
    51 | java -jar caster.jar -d 192.168.0.22 -t -f "/Users/leon_nicholls/Downloads/video.wmv" 52 |
    53 |
  • 54 |
  • Transcode a local file with custom VLC transcoding parameters: 55 |
    56 | 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" 57 |
    58 |
  • 59 |
  • Start the REST API server on the default port 8080: 60 |
    61 | java -jar caster.jar -r 62 |
    63 |
  • 64 |
65 | 66 |

67 | 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. 68 | Here are the HTTP requests supported: 69 |

    70 |
  • List devices (HTTP GET: /devices): 71 |
    72 | curl -i -X GET http://192.168.0.50:8080/devices 73 |
    74 | With a JSON array response: 75 |
    76 | [{"ip_address":"192.168.0.22","name":"Living Room"}] 77 |
    78 |
  • 79 |
  • Playback status (HTTP GET: /playback): 80 |
    81 | curl -i -X GET http://192.168.0.50:8080/playback?device=192.168.0.22 82 |
    83 | With a JSON object response (state value can be "idle", "playing" or "stopped"): 84 |
    85 | {"duration":27,"time":12,"state":"playing"} 86 |
    87 |
  • 88 |
  • Play stream (HTTP POST: /playback): 89 |
    90 | 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 91 |
    92 |
  • 93 |
  • Play file (HTTP POST: /playback): 94 |
    95 | curl -i -X POST -d "device=192.168.0.22&file=/Users/leon_nicholls/Downloads/video.mp4" http://192.168.0.50:8080/playback 96 |
    97 |
  • 98 |
  • Transcode file (HTTP POST: /playback): 99 |
    100 | 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 101 |
    102 |
  • 103 |
  • Transcode file with custom VLC URL encoded transcoding parameters (HTTP POST: /playback): 104 |
    105 | 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 106 |
    107 |
  • 108 |
  • Pause playback state (HTTP POST: /playback): 109 |
    110 | curl -i -X POST -d "device=192.168.0.22&state=pause" http://192.168.0.50:8080/playback 111 |
    112 |
  • 113 |
  • Play playback state (HTTP POST: /playback): 114 |
    115 | curl -i -X POST -d "device=192.168.0.22&state=play" http://192.168.0.50:8080/playback 116 |
    117 |
  • 118 |
  • Stop playback state (and close app) (HTTP POST: /playback): 119 |
    120 | curl -i -X POST -d "device=192.168.0.22&state=stop" http://192.168.0.50:8080/playback 121 |
    122 |
  • 123 |
124 |

125 | 126 |

ChromeCast devices only support a limited number of media formats. 127 | Caster has experimental support for converting other media formats into WebM using the vlcj library for VLC. 128 | 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. 129 | 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: 130 |

131 | :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 132 |
133 | Note that converting video is very CPU intensive. It might take several seconds for the video to start playing on your ChromeCast device. 134 |

135 | 136 |

The computer running the Caster application needs to be on the same network as the ChromeCast device. 137 | 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.

138 | 139 |

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

140 | 141 |

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. 142 | This caster.jar build can be used with your own "-id" app id as a command-line parameter.

143 | 144 |

Other apps developed by Entertailion: 145 |

155 |

156 | -------------------------------------------------------------------------------- /libs/commons-cli-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoRulesJustFeels/Caster/649b485dd492c7d0740288658ece2c468d857320/libs/commons-cli-1.2.jar -------------------------------------------------------------------------------- /libs/commons-logging-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoRulesJustFeels/Caster/649b485dd492c7d0740288658ece2c468d857320/libs/commons-logging-1.1.1.jar -------------------------------------------------------------------------------- /libs/httpclient-4.2.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoRulesJustFeels/Caster/649b485dd492c7d0740288658ece2c468d857320/libs/httpclient-4.2.5.jar -------------------------------------------------------------------------------- /libs/httpcore-4.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoRulesJustFeels/Caster/649b485dd492c7d0740288658ece2c468d857320/libs/httpcore-4.2.4.jar -------------------------------------------------------------------------------- /libs/java_websocket.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoRulesJustFeels/Caster/649b485dd492c7d0740288658ece2c468d857320/libs/java_websocket.jar -------------------------------------------------------------------------------- /libs/jna-3.5.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoRulesJustFeels/Caster/649b485dd492c7d0740288658ece2c468d857320/libs/jna-3.5.2.jar -------------------------------------------------------------------------------- /libs/json-simple-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoRulesJustFeels/Caster/649b485dd492c7d0740288658ece2c468d857320/libs/json-simple-1.1.1.jar -------------------------------------------------------------------------------- /libs/platform-3.5.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoRulesJustFeels/Caster/649b485dd492c7d0740288658ece2c468d857320/libs/platform-3.5.2.jar -------------------------------------------------------------------------------- /libs/vlcj-2.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NoRulesJustFeels/Caster/649b485dd492c7d0740288658ece2c468d857320/libs/vlcj-2.4.1.jar -------------------------------------------------------------------------------- /receiver/index.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 64 | Caster 65 | 66 |