How to instantiate an AVMutableCompositionTrack with type AVMediaTypeText
Asked Answered
S

1

7

I'm trying to place some text of a part of a video that I'm creating. I realize that I can use a layer with text over an entire length of the video using CALayers, but how do I do it over only part of the video? After some research I have found that you can create a AVMutableCompositionTrack of type AVMediaTypeText, and it seems like that might do the trick; however, I cannot find any examples of how to declare, instantiate, etc of such a track?

I'm declaring it as such :

AVMutableCompositionTrack *textTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeText preferredTrackID:kCMPersistentTrackID_Invalid];

now how do I actually add text to it or instantiate with it with a string?

any input appreciated.

Stative answered 10/10, 2013 at 2:50 Comment(2)
Did you ever solve this issue? I find I can't use CALayer since it introduces a lot of complicated calculations I don't think is necessary if all i want to do is display text at discrete times int he videoBrynhild
@marina and @ Michael Nguyen have you found solution to this issue? I am also facing same issue.Deme
E
0

To add a text overlay to a video, you can use AVMutableVideoComposition object that will be assigned to AVAssetExportSession's videoComposition property.

Check out this sample project from app:

https://developer.apple.com/library/ios/samplecode/AVSimpleEditoriOS/Introduction/Intro.html

Exequies answered 17/12, 2013 at 10:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.