videogular / videogular2

The HTML5 video player for Angular 2
https://videogular.github.io/videogular2-showroom/#/
MIT License
670 stars 211 forks source link

[Question] videogular to show subtitles embedded in a mp4 file? #879

Closed kumail-raza closed 4 years ago

kumail-raza commented 4 years ago

Is there a way or support for showing the embedded subtitles in a mp4 file, with videogular?

kumail-raza commented 4 years ago

?

sliceofbytes commented 4 years ago

Embedded subtitles are not supported by HTML5 video at the moment.

You have basically two options:

  1. Extract the subtitles into VTT (recommended)

Then you just add each language as a normal html5 video track element.

<video width="640" height="480" controls>
  <source src="video.mp4" type="video/mp4" />
  <source src="video.webm" type="video/webm" />
  <track src="subtitles.vtt" kind="subtitles" srclang="en" label="English" />
</video>
  1. Use an in browser mp4 utility like mp4box.js to extract the embedded subtitles on the fly and dynamically add them.

https://gpac.github.io/mp4box.js/#extraction