Recently contacted FFmpeg, found a lot of relevant compilation data, have not compiled successfully, a few days ago on GitHub to find a script (https://github.com/kewlbear/FFmpeg-iOS-build-script), can be perfectly compiled
The steps are as follows:
1. Download script: Https://github.com/kewlbear/FFmpeg-iOS-build-script, to run this script,
Preparation conditions:
- Download the file first:https://github.com/libav/gas-preprocessor,
- Copy gas-preprocessor.pl to/usr/sbin,
- chmod 777/usr/local/bin/gas-preprocessor.pl
2. Unzip to find the file build-ffmpeg.sh
3. Implementation of the Service document:./build-ffmpeg.sh, note that there may be errors when installing this service,
as follows: Mac:ffmpeg-ios-build-script-master-2 jinsonglnan$./build-ffmpeg.sh
yasm not found
Homebrew not found. Trying to install ...
Whoops, the Homebrew installer has moved! Please instead run:
ruby-e "$ (Curl-fsslHttps://raw.githubusercontent.com/Homebrew/install/master/install)"
Also, please ask wherever your got this link from to update it to the above.
Trying to install yasm ...
./build-ffmpeg.sh:line 67:brew:command not found
Meaning, no yasm, see Prompt to execute ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"
Installation
4. After the compilation is complete, the terminal enters the Ffmpeg-ios-build-script directory and enters the./build-ffmpeg.sh Lipo, this command is about. A file merged into a
5. Add the Ffmpeg-ios file to the project
6. add a header file reference #include" avformat.h "
add an API statement: Av_register_all (); to a class file. m suffix changed to. mm, turn on mixed mode.
Operation of the project, if there is no error, it indicates that the compilation succeeded
7. Additional attention to detail
Compile error: ' libavcodec/avcodec.h ' file not found, Span style= "line-height:24px" > modify header Search paths Path: $ (project_dir)/ffmpeg-ios/include
FFmpeg perfectly compiled on iOS