简体   繁体   中英

What is the fastest and most efficient way on iOS to downscale a HD video to SD?

I have a video which is represented as AVURLAsset. It comes from Camera Roll and is at full resolution.

Now if I only need it with 380 pixels width, what would be the fastest and most efficient way to get a downsampled copy of the video?

Is AVAssetExportSession the way to go? It also looks like AVAssetExportSession only works with presets. But in this case I want to specify custom pixel dimensions.

"An AVAssetExportSession object transcodes the contents of an AVAsset source object to create an output of the form described by a specified export preset."

Or must I look at other classes in AVFoundation? Or other frameworks even?

AVMutableVideoComposition has a renderSize property or AVAssetWriter/WriterInput has an ability to resize frame as you want, as well as other tweaks are possible (you are supplying output size/settings in dictionary), but it comes with necessity to set the whole stuff up (asset reader, feeding frames etc.). If you find better solution, let me know :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM