Closed captions have become inseparable part of any video. Making it possible to watch Scandinavian independent cinema. Helping the hearing impaired experience the Game of Thrones as good as it gets. We all benefit from them.
Most video players have option to load subtitles from file. However, that means that if you want to deliver video with subtitles to your client, you’d have to send not only media file, but subtitles files too. What if they get mixed up? Or how to be sure that we have sent all available subtitle files to client? Fortunately there are other ways.
The first option is to burn subtitles into every frame of video. Sometimes it is needed for devices which can’t transform frames by themselves. Old TVs are a good example here. But it doesn’t mean we should be limited by old technology? Of course not. The second option is to use closed captioning. It allows to put multiple subtitles into one video file. Each of them will be added as a separate subtitle track. Now anyone who downloads video with closed captions embedded will be able to select which one to use or if disable them if not needed.
Closed captions are must have these days and we didn’t want to be left behind. So, there’s new parameter in H.264 preset which enables closed captioning. At the moment it is accessible only through our API but we are working on adding it to our web application. The parameter name is ‘closed_captions’ and the value can be set to:
- ‘burn’ – with this setting Panda will take the first subtitle file from list and add subtitles to every frame
- ‘add’ – with this setting Panda will put every subtitles from the list into separate track
Here’s a snippet of code in Ruby with an example how to use it:
Panda::Profile.create( :preset_name => "h264", :name => "h264.closed_captions", :closed_captions => "add" ) Panda::Video.create!( :source_url => "VIDEO_SOURCE_URL", :subtitle_files => ["SUBTITLE_1_SOURCE_URL", "SUBTITLE_2_SOURCE_URL", "SUBTITLE_3_SOURCE_URL"], :profiles => "h264.closed_captions" )
Panda supports all major subtitles formats like SRT, DVD, MicroDVD, DVB, WebVTT and many more.