The app I am working on edits video files and merges them into an AVComposition. This is done in a pretty straight forward way that has been well documented: Create a AVMutableComposition... Create Video and Audio tracks. Insert video and audio segments onto these tracks. Create an AVVideoComposition object. Populate it with layer instructions.
I am now interested in adding filters to my AVComposition (to be presented in an AVPlayer and later to be exported to an mp4 file).
The only way to add a filter to an AVComposition I was able to find, was to use the AVMutableVideoComposition's videoCompositionWithAsset:applyingCIFiltersWithHandler initializer.
However, as others have noted, initializing the AVMutableVideoComposition this way does not allow to later add the necessary layer instructions.
More so, I cannot find a way to specify a start point and duration for the assigned filter (but this is less of a problem for me at this point).
All the resources I've found on using filters in AVFoundation do not use merged videos, rather apply the filter on one video asset. I have tried using the AVComposition as that asset, but without being able to use my layer instructions, the result is useless.
Any idea how I can create such a composition that merges videos and is also able to apply a filter (sepia..., brightness, etc..).
Thanks
I found this link but it is not clear: How to use layer instruction into videoCompositionWithAsset:applyingCIFiltersWithHandler method
When attempting to initialize the
I get the following error/exception:
[AVCoreImageFilterCustomVideoCompositor startVideoCompositionRequest:] Expecting video composition to contain only AVCoreImageFilterVideoCompositionInstruction'