Question

I'm relatively new to iOS development and there is something I'm trying to achieve but I'm out of luck finding good resources. I would like to embed subtitles to a video file for a project. The user records a video, after recording he inputs some sentences, and the text he input gets embedded into the video as a subtitle, one word at a time. I think this is achieved through AVFoundation but to my surprise there is relatively little information on AVFoundation except Apple's documentation (which is not of much use when you want to embed subtitles.)

How might one go about doing this? How do I need to format the text input so that it becomes a subtitle track? How do I embed that subtitle track to the video file and export it so that the video always has the subtitles on it? I hope someone here knows about these things..

Thanks in advance.

Was it helpful?

Solution

If you are looking to create a QuickTime video with embedded subtitles (AKA soft subtitles) in it, see avsubtitleswriterOSX sample code from WWDC 2013.

If you prefer to burn subtitles into a video, you can use AVVideoCompositionCoreAnimationTool, as described in this tutorial

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top