I am building iOS application that is able to record video and add animation overlay over recorded video with AVFoundation
and CAAnimation
.
All sub features are working fine but end of video's background is black while animation is playing. It's not rendering background video that I selected.
I've used AVAssetWriter
to record video and it's well played on camera roll. But if I use this recorded video to add overlay, end of video's background is black. Interesting thing is if I record video via native iOS camera app and use it to add overlay, it's working perfectly.
I've checked this question but did not work for me. Black Video CAAnimation and AVFoundation AVAssetExportSession
Any help would be greatly appreciated. Thanks
You need to correct preferredTransform of asset, cause for some video files it has empty tx and ty parameters (by default they're 0.0):