Flussonic Media Server documentation

Converting DVB subtitles to WebVTT

Flussonic Media Server can recognize DVB subtitles and convert them to the text format WebVTT. This is useful for displaying subtitles on the devices and players that do not support DVB.

To recognize DVB subtitles, Flussonic uses the Tesseract OCR tool. Tesseract recognized the text and passes it to Flussonic, and Flussonic then creates WebVTT subtitles, which are transmitted via HLS.

About DVB subtitles Anchor Anchor x2

The DVB standard (Digital Video Broadcast) defines a bitmap based subtitling format.

In an MPEG-TS stream received from a satellite, DVB subtitles can be in the text form or as a picture. Most often it's a picture because it's more reliable for viewing on different devices that may not have the right fonts for drawing text.

For example:

ffmpeg -i video.ts 
Stream #0:0[0x1a4]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1ae](fra): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 128 kb/s
Stream #0:2[0x1af](qad): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 128 kb/s
Stream #0:3[0x1b8](fra): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
Stream #0:4[0x1b0](qaa): Audio: eac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 128 kb/s
Stream #0:5[0x1b9](fra): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)

Here dvb_subtitle are subtitles that come as images.

Such subtitles can are supported by some set-top-boxes, some TV sets, and by the VLC player, but not by iPhones or Android devices. Flussonic Media Server converts these pictures back to text for displaying on those devices.

About WebVTT subtitles Anchor Anchor x2

WebVTT (Web Video Text Tracks) is a common subtitle format that is supported by browsers and provides other options. Recognizing DVB subtitles and converting them to WebVTT helps reduce the load on the transmission channel.

The file of the WebVTT format is a regular text file with the extension .vtt, containing a line-by-line list of markers of the start time and end time and the text for displaying at that time.

You can connect several WebVTT files with text in different languages to a video container. You need to create a separate file for each language.

These files can be used to transfer additional data to JS players. For example, URL preview images for video frames. The WebVTT standard also supports CSS styling and different options to place the subtitles in the video display area.

Installation and setup Anchor Anchor x2

Tesseract is a high-quality console OCR engine with open source. Currently, the program works with UTF-8, and supports many languages by means of additional modules.

To set up DVB recognizing and converting:

  1. Install Tesseract on the server with Flussonic.

    For Ubuntu, you can install the package flussonic-tesseract:

    apt install flussonic-tesseract
    
  2. After installing Tesseract, add to the settings of the stream the following line:

    dvbsubs_ocr=true;
    

    The option dvbsubs_ocr=true turns on the recognition and conversion of DVB subtitles into WebVTT.

    Example:

    stream ort {
      url tshttp://source:8080/stream dvbsubs_ocr=true;
    }
    
  3. Apply the new configuration by running this command in the console:

/etc/init.d/flussonic reload

If Tesseract has started successfully, the following lines appear in the logs:

09:44:17.986 <0.966.0> [sow] tesseract_worker:58 start ocr for slv
09:44:18.275 <0.966.0> [sow] tesseract_worker:58 start ocr for srp
09:44:18.759 <0.966.0> [sow] tesseract_worker:58 start ocr for swe
09:44:19.045 <0.966.0> [sow] tesseract_worker:58 start ocr for dan
09:44:19.328 <0.966.0> [sow] tesseract_worker:58 start ocr for nor

Example of an HLS playlist index.m3u8 with subtitles:

#EXTM3U
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="eng",URI="http://flussonic-ip/index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="French",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="fra",URI="http://flussonic-ip/index.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="German",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="deu",URI="http://flussonic-ip/index.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=450560,RESOLUTION=480x352,SUBTITLES="subs"
http://flussonic-ip/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=855040,RESOLUTION=480x352,SUBTITLES="subs"
http://flussonic-ip/index.m3u8