It seems that on iOS 9 & 10, the pixels from the previous layer are not cleared and the next frame is just rendered on top. The issue is not with the createVideoComposition method. This returns a correct outputImage which is masked perfectly for each frame. It seems the issue is that all the video's frames are drawn on AVPlayerLayer and never cleared. The latest frame that needs to be displayed is simply drawn on top of the rest.
Note: I tested this on a real device (not simulator): iPod touch & iPad mini
Any idea what might be causing this issue or how I could fix this?
I have some troubles in iOS 9 & iOS 10。The final video seems like to be stretched in iOS9 &iOS10 。and in iOS9,it have some shadow。applyingCIFiltersWithHandler seems like not remove prevouis outputImage in iOS 9。
I tried saving this video into gallery using AVVideoComposition but didn't got any success. It just saved the the transparent video with black background and not the colourful views!