Production of IOS video thumbnails

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.