Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does HTML5 Video support srt textTrack?

I have tried the html5 video with textTrack, it works properly with .vtt (WebVTT). However, it doesn't work with .srt.

So my question is whether html5 support .srt on the chrome or firefox?

I have looked the information in w3 but there are no information about srt.

http://www.w3.org/TR/html5/embedded-content-0.html#attr-track-kind-subtitles

I have also investigated on some players. Most of them parse the .srt instead of the html5 video textTrack.

So I want to find if any document about .srt subtitle format in the native html5 player.

Thanks

like image 287
Thomas Lee Avatar asked Nov 17 '14 08:11

Thomas Lee


People also ask

Does HTML5 support SRT?

Since HTML5 we can add captions to video's, however only VTT formatted captions are supported. The majority of subtitles are in SRT format, but can't be used as captions in HTML video's.

Does HTML5 support video?

The HTML5 video format capabilities include three options to play: MP4, WebM, and Ogg. You should note that the Safari browser does not support Ogg, WebM is supported by only 58% of browsers, and MP4 is disabled by default in Firefox 24.


1 Answers

Yes , you are correct. .srt is not working with html5, but .vtt does . if we use .srt then we may need a special player. But we can simply convert .srt to .vtt .

There isn't much difference between those two,it is Only the way they represent milliseconds. And also there is a WEBVTT in the beginning of .vtt files . (online converter https://atelier.u-sub.net/srt2vtt/) i.e.

**srt**
3
00:00:06,071 --> 00:00:08,926
Firstly, when to use it.
When are the best times?

**vtt**
3
00:00:06.071 --> 00:00:08.926
Firstly, when to use it.
When are the best times?

Final code block for html5 is like below

<html>
<video id="video" controls preload="metadata">
   <source src="3798-233163.mp4" type="video/mp4">
   <track label="English" kind="subtitles" srclang="en" src="3798-233163.vtt" default>
   <track label="Deutsch" kind="subtitles" srclang="de" src="3798-233163_1.vtt">
   <track label="Español" kind="subtitles" srclang="es" src="3798-233163_2.vtt">
</video>
</html>
like image 179
aads Avatar answered Sep 19 '22 18:09

aads