The problem is this: I have a AVMutableVideoComposition which has a titleLayer (CATextLayer).
I want to display to the user a preview containing this title, using AVPlayerLayer and AVSynchronizedLayer. I setup the layer like this:
- (CATextLayer*)buildTitleLayer {
CATextLayer *titleLayer = [CATextLayer layer];
// titleLayer.font = @"Helvetica";
titleLayer.fontSize = 15.0;
//?? titleLayer.shadowOpacity = 0.5;
titleLayer.backgroundColor = [UIColor blackColor].CGColor;
titleLayer.alignmentMode = kCAAlignmentCenter;
titleLayer.frame = CGRectMake(0, 0, _videoSize.width, _videoSize.height / 6); //You may need to adjust this for proper display
return titleLayer;
}
When I setup the composition I do this:
[compositionVideoTrack setPreferredTransform:clipVideoTrack.preferredTransform];
Everything runs as expected with one exception:
When I preview the end result (video+title) in the iPhone simulator I get this output:
When I render the video using AVAssetExportSession I get this output (so the video label is on the bottom):
Does anyone know what is the trick? What am I missing/doing wrong?
Thanks!
The answer can be found here
How to properly export CALayer on top of AVMutableComposition with AVAssetExportSession