Build FFmpeg for iOS-2018-10-26

2063 ワード


# Build-FFmpeg-For-iOS-README

OS: macOS Mojave 10.14 (18A391)
Xcode: Version 10.0 (10A255)
FFmpeg version: 4.0.2


Tools Needed:
1. gas-preprocessor
2. FFmpeg-iOS-build-script
3. yasm : brew install yasm

1. Download FFmpeg-iOS-build-script from github(https://github.com/kewlbear/FFmpeg-iOS-build-script);
2. Change the ffmpeg version before compiling. FFmpeg: FF_VERSION="4.0.2",iOS:DEPLOYMENT_TARGET="8.0";
3. Open the Terminal, cd the FFmpeg-iOS-build-script folder, Execute the following command "$ ./biuld-ffmpeg.sh";
4. Execute the following command "$ ./build-ffmpeg.sh lipo" to merge ".a" files after step 3 is completed;
5. Drag the "FFmpeg-iOS" folder to your target project after the step 4 is completed;
6. Setting the target project: Build Settings -> Header Search Paths Add the file search path: $(SRCROOT)/YourProject/FFmpeg-iOS/include;
7. Add libz.dylib, libbz2.dylib, libiconv.dylib or libz.tbd, libbz2.tbd, libiconv.tbd to the project;
8. Final add the VideoToolbox.framework to the project;

Questions:
1. compiling failed,sh File contains the href:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Execution to this sentence indicates that yasm is not installed, and installing yasm requires
homebrew, so the above statement is incorrect when installing homebrew.

---------------Solution:
Install homebrew before installing yasm

2. compiling failed
xcrun -sdk iphoneos clang is unable to create an executable file.
C compiler test failed.

---------------Solution:

First
1) Check your Git version
2) Make sure you are using the lastest version from Git

Second
1) Find "ffmpeg-armv7/ffbuild/config.log" search the detail error with keyword like "xcrun: error"
2) My case ,found the detail "xcrun: error: SDK "iphoneos" cannot be located"

Third
1) Terminal input "sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/"
2) Input password
3) Try again