go-chromecast icon indicating copy to clipboard operation
go-chromecast copied to clipboard

Native subtitles

Open DDoubleU opened this issue 5 years ago • 15 comments

Is there any update about subtitle support? I've read that WebVTT and TTML formats are natively supported (unlike SRT and ASS). Does this mean they can be "pushed" towards the chromecast without any further processing? Is it possible for go-chromecast to check the directory of the file indicated by the "load"-parameter for such subtitle files and add them to the stream?

Thanks in advance!

DDoubleU avatar Feb 19 '19 12:02 DDoubleU

Hello! I believe this should be possible, however, I haven't ever tried to use subtitles when loading any media with the chromecast. Let me play around with it and see how it works.

vishen avatar Feb 19 '19 19:02 vishen

Hi Jonathan, have you looked into this? I would like to take a look into this, it might help if you have already got some information on this.

w8mr avatar Oct 07 '20 14:10 w8mr

Hello! Oh awesome! I think I started to look into this but didn't get very far, sorry. I don't have any information that is useful on this unfortunately.

vishen avatar Oct 07 '20 14:10 vishen

Ok, I will start from scratch then.

w8mr avatar Oct 07 '20 15:10 w8mr

I've got a Proof of concept working. Still need to:

  • remove hardcoded url
  • discovery of subtitles
  • parameter for subtitle
  • auto convert from other formats (with ffmpeg)
  • extract (and convert) embedded subtitles into separate vtt file

w8mr avatar Oct 09 '20 11:10 w8mr

Any update on this? I want to use this for anime, and I can't find anything at all that can handle both .mkv files and subtitles. This handles .mkv well, but I really need subtitles working for my intentions.

Mojken avatar Apr 12 '21 17:04 Mojken

It looks like @w8mr made some initial progress with https://github.com/w8mr/go-chromecast/commit/1f13ee7facea4c359f404e99e254d4e7d631add5, but unsure if it is complete. Happy to accept a PR if someone knows how to do this?

vishen avatar Apr 18 '21 21:04 vishen

Subtitle support would be nice! @w8mr is there any work needed on your branch to be ready for a pull request?

LeonB avatar Sep 04 '21 20:09 LeonB

  • This is essential, because all non native English speakers use subtitles almost always.

  • Cast with external WebVTT subtitles (without transcoding), where you can look at the source code:

    • Castnow: still works today, but it's abandoned since 2019. This does live transcoding for non compatible videos. Javascript.
    • Catt: this is active, but don't do live transcoding. Python.
  • I know that I can transcode (maybe ffmpeg) the video with hardcoded subtitles, but it's an extra pass.

Disonantemus avatar Jul 12 '23 19:07 Disonantemus

I've got a Proof of concept working. Still need to:

* remove hardcoded url

* discovery of subtitles

* parameter for subtitle

* auto convert from other formats (with ffmpeg)

* extract (and convert) embedded subtitles into separate vtt file

If go-chromecast has an external subtitle switch (maybe --subtitle file.vtt) that allows WebVTT, that don't need to be hardcoded, all the extra steps can be done in shell script with ffmpeg. I have a small shell script that did a while a go for Castnow, that it's not pretty (I'm no programmer), but works.

Disonantemus avatar Jul 12 '23 19:07 Disonantemus

I don't have ant time to work on this, but I am happy to accept a PR for this feature. I think it would be a useful feature and don't see any reason we couldn't support this if castnow and catt can do it.

vishen avatar Jul 13 '23 22:07 vishen

Here is the PR that added the initial support for subtitles: https://github.com/skorokithakis/catt/pull/207/files and that eventually uses https://github.com/home-assistant-libs/pychromecast/blob/db4100a1fa9be22be6683c80abfe7ff3a55b31c8/pychromecast/controllers/media.py#L478-L495. It looks like you can serve the subtitles over HTTP and then tell the Chromecast to fetch the subtitles from there.

vishen avatar Jul 13 '23 22:07 vishen

https://github.com/vishen/go-chromecast/pull/165 not sure if i'll ever polish this myself, so linking it here so others might either use it (it is functioning as far as i can tell for mkv with included subtitles) it has unrelated changes enabling cuda encoding/decoding to accelerate them so you'll have to revert https://github.com/vishen/go-chromecast/pull/165/files#diff-e1208656496d86949b6894b55983f87d25360bc08bc50b138df07965a33b4c29L1131-L1134 if you try to use it but dont have cuda...

Jiyuu avatar Jul 28 '23 15:07 Jiyuu

It should be possible to convert to WebVTT and provide subtitles as external files. This is how I did it with https://github.com/anacrolix/castlink.

Just checking in on this project to see what alternatives exist, since that's a 9 year old Elm app now. I don't see any support for external subtitles is that correct?

anacrolix avatar Apr 04 '24 02:04 anacrolix

That is correct. There is some initial progress here https://github.com/w8mr/go-chromecast/commit/1f13ee7facea4c359f404e99e254d4e7d631add5 but I don't think it was event completed.

vishen avatar Apr 04 '24 20:04 vishen