The HW Blog

Want to be updated? @opencoconut | Feed

Introducing Closed Captions for MP4 and HLS

Bruno Celeste (@brunoceleste)

March 25, 2014 Features

We are happy to announce the support of closed captions for MP4 and HLS formats. We currently support SRT and WebVTT as input format.


MP4 Closed Captions

If the output is an MP4 file, the captions will use the mov_text codec with fourcc tx3g, so it's compatible with everything from quicktime to iOS and more.

Captions for HTTP Live Streaming format

With the HLS format, it's a different work as we need to segmentize the caption files first and then generate the associated playlist in m3u8. If the input captions are SRT files, we will automatically convert them into proper WebVTT files.
The file structure stays very simple, the playlist and webvtt files will be uploaded to the same directory than the other video segments and playlists.

The naming convention is caption-$lang.m3u8 for the playlist and caption-$lang-$num.webvtt for the caption segment files:


Using the API

As usual, the API is very simple: you give one or more caption URLs (caption_urls), languages (caption_languages) and names (caption_names) separated by comma, and you are done. Here is an example:

The config file captions.conf:

video_id = 1234,
format_ids = HLS_360p_600K,HLS_360p_1000K,HLS_720p_1500K
output_url = s3://a:s@bucket/hls
caption_urls =,
caption_languages = en,es
caption_names = English,Español

url =

Create the job in ruby:

hw ="HW-API-Key", "k-api-key")
ini ="captions.conf")
hw.create("robot/job", ini)

Any Comment? Send us a message on Twitter @opencoconut
If you have questions or feedbacks, you can also contact us via our contact page