video - Retrieving movie codec under iOS? -


i trying find codec used compress movie. sure if need somehow use cmformatdescription , cmvideocodectype key. stuck how past metadata array. ideas on how retrieve codec?

avurlasset* movieasset = [avurlasset urlassetwithurl:sourcemovieurl options:nil];

nsarray *tracks = [movieasset trackswithmediatype:avmediatypevideo];  if ([tracks count] != 0) {     avassettrack *videotrack = [tracks objectatindex:0];      //     // let's movie's meta data     //      // find codec     nsarray *metadata = [movieasset commonmetadata];  }    

a more readable version of @jbat100's answer (for confused #define fourcc2str, hah)

// format description whichever track want cmformatdescriptionref formathint;  // codec , correct endianness cmvideocodectype formatcodec = cfswapint32bigtohost(cmformatdescriptiongetmediasubtype(formathint));  // add 1 null terminator char formatcodecbuf[sizeof(cmvideocodectype) + 1] = {0}; memcpy(formatcodecbuf, &formatcodec, sizeof(cmvideocodectype));  nsstring *formatcodecstring = @(formatcodecbuf); 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -