Subtitle Live Streaming

Demo page:  Mouse over the player, click the CC button to choose language.
Even though this video is pre-recorded, the way the components are setup is well-suited for live subtitles.
With regular WebVTT, .vtt file name is in “tracks:”, a property of the player, parallel to “file:” property, and it’s loaded during player initialization. Therefore it only supports VOD subtitles.
With Segmented WebVtt, newly generated .vtt files are appended to the subtitle .m3u8 files, just like new .ts files are appended to video .m3u8 files. Subtitle .m3u8 is EXT-X-MEDIA of the master playlist, and therefore subtitle playlist are refreshed along with video playlist to render live video and subtitle.



HLS audio video decoupled: two audio ts streams share one video ts stream

Audio and Video can be specified separately. In another word, audio and video can be in separate .ts files, and therefore the same video can be shared by different audio, most commonly, for different languages. This feature was added in HLS version 4.
(VLC223 doesn’t support this; it has to be audio video in the same .ts file)
In this sample stream,, played by JW Player, the audio can shifted between English and Chinese.

Pitfall: it happened that some video works on Windows, but not on Android. Most likely it’s caused by the .ts files, instead of the .m3u8 playlists.

Thanks to Jimmy for pointing this out.


HLS segmentation

Two ways to do this: server pull or video source push
Push: server runs nginx-rtmp-module, video comes in through RTMP
Pro: all video source devices can stay behind NAT in case no control on router.
Pull: server runs ffmpeg to pull video directly from cameras through RTSP.
Pro: no server needed on video source site, since server directly talks to cameras.
ffmpeg is far more feature rich than nginx-rtmp-module
rtmp-module doesn’t even have the option to organize segment into sub folders
(think hundrdeds of thousands of .ts files).

Extra credits to ffmpeg:
Some software stays stable by keeping the feature set small.
However, not only does Ffmpeg stays stable, but it has so many features and does every single one so well.