Using the Avfoundation framework, you can generate video thumbnails using the following classes:
"Avasset:
Used to obtain information about multimedia, such as the picture and sound of multimedia.
"Avurlasset:
Subclass of Avasset, used to generate Avasset objects based on Nsurl
"Avassetimagegenerator:
Animation for capturing a specified frame of video
General steps:
1, according to the video Urlchuang see Avurlasset object
2. Create Avassetimagegenerator objects based on Avurlasset objects
3. Call the Avassetimagegenerator object's copyCGImageAtTime:actualTime:error: To get the video at the specified point in time for the video
First parameter: specifies the video at which point in time, the parameter is a cmtime struct: (cmtime. Value/timescale = seconds)
typedefstruct{Cmtimevalue value; /*! @field value The value of the cmtime. Value/timescale = seconds.*/Cmtimescale Timescale; /*! @field timescale The timescale of the cmtime. Value/timescale = seconds. */Cmtimeflags flags; /*! @field flags The flags, eg kcmtimeflags_valid, kcmtimeflags_positiveinfinity, etc.*/Cmtimeepoch Epoch; /*! @field epoch differentiates between equal timestamps that is actually different because of looping, multi-item sequencing, etc. 'll is used during comparison:greater epochs happen after lesser ones. Additions/subtraction is only possible within a single epoch, however, si nCE epoch length may unknown/variable. */} cmtime;
Get Cmtime correlation function:
cmtime cmtimemake ( int64_t value, /*! @param Value*/ int32_t timescale) /*@param timescale */ __osx_ Available_starting (__MAC_10_7,__IPHONE_4_0); Cmtime cmtimemakewithseconds ( Float64 seconds,
__osx_available_starting (__MAC_10_7,__IPHONE_4_0);
second parameter: gets the actual point in time (to use "&" to pass the pointer)
third parameter: get the error message (You want to use "&" to pass a pointer)
Production of IOS video thumbnails