Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 718
jft0m Avatar asked Nov 27 '25 23:11

jft0m


1 Answers

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

like image 87
Azat Avatar answered Nov 29 '25 16:11

Azat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!