Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - AVPlayer using closedcaptions

Tags:

ios

captions

I'm working with AVPlayer on iOS use to "closedCaptionDisplayEnabled property" to show captions or subtitle on the movie (hls or mp4), but the caption not show anything. I don't know why?

Have you any solution to show captions(subtitle) on movie(hls,mp4)?

And i see a few sample about app, youtube, netflix, tvguide and something used to closed caption.

Maybe all the app on iphone, ipad from netflix,youtube using one file and insert subtitle inside video, i think

But, i want to use to two file (one file hls or mp4, one file srt or WebVTT)

image1, image2

Thank you for read this article!!!!

like image 596
heaven Avatar asked Nov 26 '12 08:11

heaven


People also ask

Is there a closed caption app for iPhone?

InnoCaption. InnoCaption is a free captioning service for the deaf and hard of hearing funded by the FCC (Federal Communications Commission). It provides real-time captioning on your mobile device. The app was developed in conjunction with live stenographers to provide fast, easy, accurate captioning.

Can you move closed caption to bottom of screen?

Navigate to Digital Caption Options and select Position. Select the position you want your captions to appear – top fill, bottom fill, top original ratio, or bottom original ratio.


2 Answers

The iOS AVPlayer supports captions in one of two ways: Either encoding the captions with the CEA-608 standard (a modified version of CEA-708/ATSC legacy encoding) into the segmented MPEG2-TS video files, or by providing the captions in a segmented WebVTT file, which is specified in the master m38u playlist for the the HLS video. "Soft" subtitles (which can be toggled on and off) are supported by the WebVTT standard in a similar fashion to captions (they've both categorized as timed metadata); if you preferred "hard" subtitles (where they are "burned" into the video), you would provide the subtitle data to your video encoder during the transcoding process.

See the following links for more info:

https://developer.apple.com/library/ios/documentation/networkinginternet/conceptual/streamingmediaguide/UsingHTTPLiveStreaming/UsingHTTPLiveStreaming.html

http://blog.zencoder.com/2012/07/13/closed-captioning-for-web-mobile-and-tv/

like image 164
Brandon Galbraith Avatar answered Oct 22 '22 19:10

Brandon Galbraith


Are you trying to use srt files as subtitles? Because the AVPlayer built-in closed captioning on iOS must be encoded as part of the stream (check the AVPlayer documentation). Search for a video editing software that can insert srt into the video (note: this are not baked-in subtitles that are part of the video; you can turn them on-off).

Now unless you can do that, the only other solution is to implement your own subtitles by parsing the srt file and displaying a UILabel on top of the video view.

like image 1
meelawsh Avatar answered Oct 22 '22 20:10

meelawsh