Code Monkey home page Code Monkey logo

loffmpegsample's Introduction

最近有同学来询问FFmpeg框架的使用方法 以下过程中如有问题,请简信我.

###使用环境

  • Mac OS Yosemite 10.10.5

###开发工具

  • Xcode 7.0

  • Terminal

###需要的文件链接

###编译适用于iOS平台的FFmpeg静态库

  • 打开终端Terminal进入下载后的gas-preprocessor文件夹

    • 将文件夹内的gas-preprocessor.pl文件拷贝到/usr/sbin/目录下

    • 修改/usr/sbin/gas-preprocessor.pl的文件权限为可执行权限

       chmod 777 /usr/sbin/gas-preprocessor.pl
      
  • 执行FFmpeg-iOS-build-script-master文件夹内的build-ffmpeg.sh

    • 编译所有的版本arm64armv7x86_64的静态库
     ./build-ffmpeg.sh
    
    • 编译支持arm64架构的静态库
     ./build-ffmpeg.sh arm64
    
    • 编译适用于armv7x86_64(64-bit simulator)的静态库
     ./build-ffmpeg.sh armv7 x86_64
    
    • 编译合并的版本
     ./build-ffmpeg.sh lipo
    

###编译静态库遇到的问题

  • yasm没有安装的情况

    • 解决方案1

      • 进入下载后的yasm文件夹,通过编译安装命令yasm

         ./configure && make -j 4 && sudo make install
        
    • 解决方案2

      • 使用Homebrew包管理器,进行安装

         brew install yasm
        
    • 测试是否安装成功

       yasm --verision
      
  • c test failed的情况

    • xcode环境安装过多,使用xcode-select选择默认的工具路径/Applications/Xcode-beta.app

       sudo xcode-select -s /Applications/Xcode-beta.app
      

###使用编译完成的FFmpeg静态库

  • 编译成功后,即可将FFmpeg-iOS文件夹(包含include和lib)引入到Xcode内

  • 加入依赖库libz.lib

  • 加入依赖库libbz2.lib

  • 加入依赖库libiconv.lib

  • 如有编译错误,链接文件不存在

     修改Build Setting 
     Header Search Paths = $(SRCROOT)/LOFFmpegSample/FFmpeg-iOS/include
    

###使用框架kxmovie播放视频

    NSString *path = @"";
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    
    // increase buffering for .wmv, it solves problem with delaying audio frames
    if ([path.pathExtension isEqualToString:@"wmv"])
        parameters[KxMovieParameterMinBufferedDuration] = @(5.0);
    
    // disable deinterlacing for iPhone, because it's complex operation can cause stuttering
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
        parameters[KxMovieParameterDisableDeinterlacing] = @(YES);
    
    KxMovieViewController *vc = [KxMovieViewController movieViewControllerWithContentPath:path
                                                                               parameters:parameters];
    [self presentViewController:vc animated:YES completion:nil];

loffmpegsample's People

Contributors

applexiaohao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.