Search code examples
iosobjective-cvideoavfoundationtrim

How to trim video with AVAssetReader and AVAssetWriter


For additional export options I create AVAssetReader and AVAssetWriter objects to transcode and output the video asset’s data.

I want to trim this video use AVAssetReader and AVAssetWriter.

I find others use AVAssetExportSession to trim a video, then use AVAssetReader and AVAssetWriter to compress.

Can't I merge these two steps together?


Solution

  • AVAssetReader has a property named timeRange - you can specify time range which you need to proceed, so this will allow you to trim your output file