1
votes

I'm trying to watermark a video's elapsed time onto the video frames. But I could only render a static text using AVVideoCompositionCoreAnimationTool and CALayer into for the entire video duration.

How can I apply change the text that is overlaid on the video every second?

Similar questions in Stack Overflow hasn't been answered too

1
have found the solution? I am facing same issue.Payal Maniyar

1 Answers

0
votes

You can refer

http://www.raywenderlich.com/30200/avfoundation-tutorial-adding-overlays-and-animations-to-videos

you just need to CABasicAnimation and add your title layer to it. Just check it out to changing the needed parameters its working fine. I Have done it in my one of project

CATextLayer *title = [CATextLayer layer];
// code for title layer setting
// code for the opacity animation which will remove the text
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"opacity"];
[animation setDuration:0];
[animation setFromValue:[NSNumber numberWithFloat:1.0]];
[animation setToValue:[NSNumber numberWithFloat:0.0]];
[animation setBeginTime:1];
[animation setRemovedOnCompletion:NO];
[animation setFillMode:kCAFillModeForwards];
[title addAnimation:animation forKey:@"animateOpacity"];