iOS - Reversing video file (.mov)
avassetexportsession, avmutablecomposition, ios, video
Solution
Here is my solution , maybe it can help you. https://github.com/KayWong/VideoReverse
Problem
Requirement : It sounds like litte different but this is what I want to achieve. I want to make movie (.mov) file in reverse. Just like how we rewind the movie file. I also want maintain same frame rate as my video is containing. NOTE: I do not just want to play video file in reverse order. I want to generate new movie file playing in reverse order. My Exploration : I thought of below steps to perform to do the same. - Make chunks of video files with specific frame rate using `AVAssetExportSession` - Merge all these video chunks into single movie file using `AVMutableComposition` and `AVAssetExportSession`. - Also merge audio of each file into new video file during the merge process. Using above steps , I am able to achieve resulting video file in reverse but I am having below concerns. - It takes good amount of time if video is of long duration. - It also consumes huge CPU cycles and memory to accomplish this process. Does anybody is having any other optimized way to achieve this? Any suggestion will be appreciated.