openfrog
openfrog

Reputation: 40765

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?

Upvotes: 1

Views: 314

Answers (1)

Laz
Laz

Reputation: 538

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 :)

Upvotes: 0

Related Questions