swift - Most performant method of processing video and writing to file - ios AVFoundation -


i want read in video asset on disk , bunch of processing on it, things using cicropfilter on each individual frame , cutting out mask, splitting 1 video several smaller videos, , removing frames original track "compress" down , make more gif-like.

i've come few possible avenues:

  1. avassetwriter , avassetreader

in scenario, read in cmsamplebuffers file, perform desired manipulations, write new file using avassetwriter.

  1. avmutablecomposition

here, given list of cmtimes can cut out frames , rewrite video or create multiple compositions each new video want create, export of them using avassetexportsession.

the metrics i'm concerned about: performance , power. i'm interested in method offers greatest efficiency in performing edits while giving me flexibility want. i'd imagine kind of video editing i'm describing can done both approaches want performant/with best capabilities.

in experience avassetexportsession more performant using avassetreader , avassetwriter straight forward format -> format b type conversion, said, it's not enough concerned about.

according apple's own documentation https://developer.apple.com/library/ios/documentation/audiovideo/conceptual/avfoundationpg/articles/00_introduction.html#//apple_ref/doc/uid/tp40010188:

you use export session reencode existing asset format defined 1 of small number of commonly-used presets. if need more control on transformation, in ios 4.1 , later can use asset reader , asset writer object in tandem convert asset 1 representation another. using these objects can, example, choose of tracks want represented in output file, specify own output format, or modify asset during conversion process.

given nature of question, seems don't have experience avfoundation framework yet. advice start avassetexportsession , when hit road block, move deeper down stack avassetreader , avassetwriter.

eventually, depending on how far take this, may want write own custom compositor.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -