Hacker News new | ask | show | jobs
by mumrah 4336 days ago
Looks nice! I've been using https://github.com/googlecast/CastHelloVideo-chrome plus some custom Java code to stream video content for a few months now. I'd love to have something like this as a UI instead of my cobbled mess. Drop me a PM or email @gmail if you want to compare notes. Cheers!
1 comments

Thanks. Will reach out once I get a chance: the video transcoding/streaming will be the real heavy lifting. This was mostly just a node-webkit exercise, but not sure how cleanly it will merge with the Chrome code you linked to.
The transcoding isn't actually too bad. You basically just need ffmpeg compiled from source on your box, and you can use https://github.com/fluent-ffmpeg/node-fluent-ffmpeg . You just need to transcode everything go h264 / AAC (so make sure you compile with libfdk_aac ).

The thing I have been unable to figure out so far is how to start streaming to chromecast before the transcoding is complete. It will play to the point it was transcoded when I started playing, regardless of how far it has gotten since then. I have tried transcoding to HLS which chromecast supports, but have not been able to figure it out.

Are you planning on develping this open source? I didn't see a github for the actual project on first glance.

You can actually stream the file directly to the chromecast as it's transcoding.

I've got this working in my own chromecast app mkvcast: https://github.com/maherbeg/mkvcast

See https://github.com/maherbeg/mkvcast/blob/master/lib/controll... for the parameters to use.

I got something similar working in Java by simply exec'ing ffmpeg and getting a handle on the stream. Not being able to seek kind of sucks, and Chromecast does not like infinite streams. However, I've seen that he Chromecast will actually stream some MKVs just fine (so long as the underlying codecs are supported).
Thanks for the reference! This looks like just what I need.
It's a better experience when you're dealing with a complete file and not an in-progress transcode anyways. With a file you can seek and pause/resume. That's much, much harder with a stream (if at all possible). The other trick is that the Chromecast does some poking around in the stream to figure out the total time. This requires that you support Range requests and return correct Content-Length headers.
Thanks for the tips. I will look into the headers and see if I can't implement the range quests and content-length headers correctly, it doesn't seem like it should be that difficult.
Thanks for the transcoding tips: will look into that.

Wasn't actually thinking about github for this: if I develop a lot of free time I might tidy it up for public consumption, but by default its not particularly well commented or documented.