gerow / sbserv

A tiny file server for serving media
BSD 2-Clause "Simplified" License
9 stars 1 forks source link

Figure out unreliable Chrome MKV "support" #20

Open gerow opened 8 years ago

gerow commented 8 years ago

Discussion of this started in https://github.com/gerow/sbserv/pull/17. It seems that chrome secretly supports playing video in the mkv format if you just say it's a webm even if the video isn't in VP8 format, but doesn't play the audio for whatever reason.

It's likely that the mkv working as a webm with formats that aren't technically supported by webm (webm only technically allows VP{8,9} and Vorbis/Ormus) was just an accident. I'm pretty sure at some point in time the audio worked too.

We should figure out if Chrome has proper support for mkv (using video/x-matroska perhaps?). If not, it might be easy to get chrome to support this with a little bit of plumbing effort.

gerow commented 8 years ago

@seansaleh It actually looks like most of the mkv files on the server use AC3 for the audio, which Chrome doesn't support.

It might make sense to either filter for this or for even more fun just transcode this to mp3 on the fly.

gerow commented 8 years ago

So, looking at the mkv format, it shouldn't be too hard to write a filter that converts that ac3 clusters to mp3 (or probably vorbis actually) on the fly.

I mean, it will be hard, but it shouldn't be that hard :sweat_smile:

gerow commented 8 years ago

Don't see anything that would allow us to really "stream" an mkv in golang. https://github.com/yanfali/gomkv seems to provide an interface to the handbrake cli for batch processing, but that's not really what we're interested in.

gerow commented 8 years ago

For the actual audio conversion it looks like gmf https://github.com/3d0c/gmf is a good option. Strange that it's called gmf when it's just C bindings for libav, but w/e.

gerow commented 8 years ago

For the mkv stuff we could just make C bindings for libmatroska. I think I'll just start working on that in another project. I'm not sure if it will ever actually lead to this working, but it's the place to start.

gerow commented 8 years ago

Ugh, so libmatroska is a C++ library, which means I'll either need to write a C wrapper for it... or just reimplement matroska in golang.

Ugh. Uuuuuuggggghhhh. Uuuuuuuuuuuuuuggggggggggggggggggghhhhhhhhhhhhhhhh.

I guess matroska in golang it is.