iBicha / UnityYoutubePlayer

Play YouTube videos in Unity
The Unlicense
336 stars 63 forks source link

Download Subtittles #37

Closed olidepalma closed 4 months ago

olidepalma commented 3 years ago

Hello! Thanks for the plugin. I am trying to use it to be able to download the video with subtitles. I have seen that for this it is necessary to use ffmpeg or avconv. Does Youtube-dl server already have them included?

iBicha commented 3 years ago

If you mean that you want to "merge" the video file with the subtitles, then yes, you need ffmpeg, and no, Youtube-dl server does not have that. If there's a need to download only the subtitles to Unity (to show them on screen for example) then using the timedtext api could be simple. E.g. List subtitles: https://www.youtube.com/api/timedtext?type=list&v=a8uyilHatBA Get english: http://video.google.com/timedtext?v=lT3vGaOLWqE&&lang=en You can also specify the format with http://video.google.com/timedtext?v=lT3vGaOLWqE&&lang=en&fmt=vtt

And then it's a matter of parsing the response (parsing xml in C#) reading the times and syncing it with the time of the video player.

iBicha commented 4 months ago

Since we stopped using youtube-dl, this feature is no longer in scope. Currently version 3.0.0 is missing subtitles, but they can be implemented using Invidious API https://docs.invidious.io/api/#get-apiv1captionsid If this feature is still important to you, please create an issue. Thanks