Subtitles in Samsung Smart TV applications

Subtitles play a very important role in a video application. Subtitles enable the video application comprehensible to viewers of languages other than the video source language. For e.g. if the video application has an audio in English, the subtitles will allow users to understand the video content in almost all the other languages in the world, thereby avoiding the work in recreating the video for other supported languages. The addition of other language subtitles involves, encoding the audio content as special text files called the subtitle files, and including some metadata to the video, so that they play the subtitle content on the screen when the corresponding video is being played. This needs support from the player that currently plays the video file.

Subtitles in Samsung Smart TV applications

Samsung Smart TV applications provide support for showing subtitle content along with the videos natively. For this, the sub-title content has to be in one of the following formats as prescribed by Samsung.

A subtitle file has the contents for the associated video file in one of the above formats. The contents from these sub-title files are read by the Samsung Smart TV platform and displayed along with the video file when played. The language of choice is based on the current language selection in the Samsung Smart TV platform. For supporting multiple languages, the developer has to include the translation file for each language along with the app. These translation files are named according to language code conventions. For e.g. the following are the language codes and the associated translation filenames for some of the languages.

  • English – EN_US
  • Russian – ru_RU
  • English (UK) – EN_UK

Native support for multiple languages

Samsung Smart TV apart from the developed applications, provides native support for multiple languages for its native display menu. This is evident from the ability to display, the OSD menu contents in the selected language in the language settings option.

Support for multiple languages in apps

Similar to the way, the OSD in Samsung Smart TV provides support for multiple languages, the applications developed for the Samsung Smart TV platform also has provisions for supporting multiple languages. For this feature, the supported language translation files have to be added to the application during the development time. If the supported language translation file is not recognized, then the Samsung Smart TV platform switches to the default platform language for the application. Samsung Smart TV platform finds the appropriate translation file using the language code. The more the support for multiple languages, the more is the scope of the app and its usage around the world.

Playing CEA-708 format subtitles

When a video file with sub-title in the CEA-708 format, it automatically parses the contents and translates if any language translations are applied and renders it on the Video Player. The following codecs are supported along with the CEA-708 subtitles.

  • MPEG-2 Video: ATSC A/53, user data
  • 264/AVC: ATSC A/72, ATSC_user_data () Syntax using the H.264 SEI Syntax 

Using SMPTE-TT or SAMI sub-title files with player

This type of sub-titles requires the downloading of the corresponding sub-title file along the video file either from local or a remote server. This functionality is included in the Video Player class which is found inside the loader library. The URL of the sub-title file is included as a parameter to the Video Player class when playing the video. The sample code snippet looks like this.

sf.service.VideoPlayer.play({
    url: "http://www.samsung.com/samsung.mkv",    // Video URL
    title: "Samsung movie",                       // Video title
    subtitle: {                                   // Subtitles option begins
        type: "sami",                             // Subtitles type. "sami" or "smpte-tt"
        url: "http://www.samsung.com/samsung.smi" // Subtitles data file path if needed
    }
});

The choice of the current sub-title language is based on the current selected language in the Samsung Smart TV OSD menu. The user can also provide the option to choose another language for the player alone. Normally the language set in the system OSD menu takes the preference, unless or otherwise a separate language is set in the application.

Using subtitles without Player API

There is also provision to use the sub-title feature without using the option given in the Video Player API. This can also be used to set various attributes for closed captions or sub-titles like the following

  • Font size
  • Font face
  • Color
  • Alignment etc.

The following object provides this facility

var closedcaption = window.webapis.tv.closedcaption || {};
var retval = closedcaption.getClosedCaptionOption(index, param);

When each sub-title content is called, it has a unique set of queries posted by the Smart TV System indicating the properties of the sub-title content. These properties are parsed by the Video Player implementation during the time of play, and the contents are displayed accordingly.

Using Custom sub-titles

If the application developer is planning to implement a custom sub-title solution, then he/she may have to obey the guidelines given by FCC in implementing the sub-title text. This also has to conform to the CEA-708 standard. A brief description of those standards will be explained further in one of my future blog posts.

This article gave a general outline of the sub-title implementation by the Samsung Smart TV system and the various ways by which the user can access those features. Although there is no practical stuff associated with this post, I will be implementing those details in either one of my blog posts or YouTube channel soon.




No Comments


You can leave the first : )



Leave a Reply

Your email address will not be published. Required fields are marked *