[IOS] Compilation and use of the FFmpeg framework on the iOS platform

Source: Internet
Author: User

Use environment
    • Mac OS Yosemite 10.10.5
Development tools
    • Xcode 7.0

    • Terminal

Required file Links
    • Gas-preprocessor
    • Yasm
    • Ffmpeg-ios-build-script
    • ffmpeg-2.8
    • Kxmovie
Compiling the FFmpeg static library for iOS platforms
  • Open Terminal Terminal to the downloaded gas-preprocessor folder

    • Place in folder gas-preprocessor.pl file Copy to /usr/sbin/ directory

    • Modify /usr/sbin/gas-preprocessor.pl The file permissions are executable permissions

       chmod 777 /usr/sbin/gas-preprocessor.pl     
  • FFmpeg-iOS-build-script-masterin the Execution folderbuild-ffmpeg.sh

    • Compile all versions arm64 , armv7 x86_64 static libraries

      ./build-ffmpeg.sh
    • Compiling arm64 a static library that supports schemas

      ./build-ffmpeg.sh arm64
    • Compiling armv7 x86_64(64-bit simulator) a static library for and

      ./build-ffmpeg.sh armv7 x86_64
    • Compiling a merged version

      ./build-ffmpeg.sh lipo
Issues encountered in compiling static libraries
  • yasm is not installed

    • Solution 1

      • Go to the downloaded yasm folder by Compile and install the command yasm

        /configure && make-j 4 && sudo make install     
    • Solution 2

      • Use homebrew Package Manager for installation

        Pre class= "Hljs mipsasm" > brew install Yasm
    • Test for installation successful

       yasm Span class= "hljs-comment" >--verision   
  • c test failedThe situation

    • xcodeToo many environments installed, using xcode-select the default tool path selection/Applications/Xcode-beta.app

        sudo xcode-select -s /Applications/Xcode-beta.app
Using the compile-completed FFmpegStatic Library
    • Once the compilation is successful, you can bring the Ffmpeg-ios folder (including include and Lib) into Xcode

    • Join the Dependent library Libz.lib

    • Join the Dependent library Libbz2.lib

    • Join the Dependent library Libiconv.lib

    • If there is a compilation error, the link file does not exist

        修改Build Setting   Header Search Paths = $(SRCROOT)/LOFFmpegSample/FFmpeg-iOS/include
Working with Frames kxmoviePlay Video
NSString *path = @""; Nsmutabledictionary *Parameters = [Nsmutabledictionarydictionary]; //increase buffering for. wmv, it solves problem with delaying audio frames if ([Path.pathextension Isequaltos tring:@"wmv"]) parameters[kxmovieparameterminbufferedduration] = @ (5.0); //Disable deinterlacing for IPhone, because it ' s complex operation can cause stuttering if (Ui_user_interface_idi OM () = = Uiuserinterfaceidiomphone) parameters[kxmovieparameterdisabledeinterlacing] = @ (YES); Kxmovieviewcontroller *VC = [Kxmovieviewcontroller movieviewcontrollerwithcontentpath:path parameters:  Parameters]; [Self PRESENTVIEWCONTROLLER:VC animated:YES Completion:nil];          

Example Project:
Loffmpeg

Compilation and use of the IOS]FFMPEG framework on the IOS platform

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.