Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support FFMPEG for windows (x64, arm64), linux (x64, arm64), macos (x64, arm64), android, ios #9

Merged
merged 42 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1246538
add arm support for linux and win
rainyl Aug 26, 2024
5c2ee7a
fix options
rainyl Aug 26, 2024
06afdea
fix
rainyl Aug 26, 2024
8299e94
fix
rainyl Aug 26, 2024
2d3a9f3
split
rainyl Aug 26, 2024
56dcffa
fix
rainyl Aug 26, 2024
0dbddfe
fix
rainyl Aug 26, 2024
549dac3
fix
rainyl Aug 26, 2024
4a536bb
fix ios
rainyl Aug 26, 2024
0e92261
fix
rainyl Aug 26, 2024
5f877e2
fix
rainyl Aug 26, 2024
0286b21
fix
rainyl Aug 27, 2024
76a82f8
fix
rainyl Aug 27, 2024
02cb2e4
fix
rainyl Aug 27, 2024
3acb171
save
rainyl Sep 20, 2024
33ad237
fix workflow
rainyl Sep 23, 2024
d600cb0
Merge branch 'main' into more-arch
rainyl Sep 23, 2024
f8aab32
fix linux
rainyl Sep 23, 2024
7298552
ffmpeg 6.1 on linux
rainyl Sep 24, 2024
1beb615
fix linux
rainyl Sep 24, 2024
1e3ddeb
finish all platforms
rainyl Sep 24, 2024
c59087a
install wget on windows
rainyl Sep 24, 2024
4290a42
fix android, linux
rainyl Sep 24, 2024
d0c1845
fix windows
rainyl Sep 24, 2024
0a5b452
fix android,linux
rainyl Sep 24, 2024
c4c3f93
fix ffmpeg_root
rainyl Sep 24, 2024
a43a043
fix
rainyl Sep 24, 2024
c54d792
fix ffmpeg-config.cmake
rainyl Sep 24, 2024
b0224f1
fix
rainyl Sep 24, 2024
4027b78
fix
rainyl Sep 24, 2024
4d616aa
fix
rainyl Sep 24, 2024
e205f3c
fix
rainyl Sep 24, 2024
620679d
fix windows
rainyl Sep 24, 2024
984efa3
fix windows
rainyl Sep 24, 2024
0538ed4
fix
rainyl Sep 25, 2024
6412a5b
fix win linux
rainyl Sep 25, 2024
69ff918
add OPENCV_FFMPEG_SKIP_BUILD_CHECK for windows
rainyl Sep 25, 2024
cec9ede
fix
rainyl Sep 26, 2024
d6393b4
finish
rainyl Sep 26, 2024
70c48b7
fix windows linux
rainyl Sep 27, 2024
f6aa18b
add ffmpeg in windows tar.gz
rainyl Sep 27, 2024
4442e08
fix windows
rainyl Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: android
on:
push:
tags:
- "*"
pull_request:
branches: ["main"]
env:
ANDROID_PLATFORM: android-24
FFMPEG_ROOT: /tmp/ffmpeg

jobs:
android:
runs-on: ubuntu-latest
strategy:
matrix:
opencv-version: [4.10.0]
abi: [armeabi-v7a, arm64-v8a, x86_64]
env:
COMMON_CMAKE_OPTIONS: |
-DCMAKE_POLICY_DEFAULT_CMP0057=NEW \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake \
-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False \
-DANDROID_PLATFORM=$ANDROID_PLATFORM \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_STL=c++_static \
-DANDROID_ABI=${{ matrix.abi }} \
-DANDROID_ARM_NEON=ON \
-DOPENCV_EXTRA_MODULES_PATH="${{ github.workspace }}/opencv_contrib/modules" \
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW \
-DWITH_ANDROID_MEDIANDK=ON \
steps:
- uses: actions/checkout@v4
- name: setup-opencv-source
run: |
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv.git opencv
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv_contrib.git opencv_contrib
echo "SOURCE_DIR=${{ github.workspace }}/opencv" >> "$GITHUB_ENV"
echo "PACKAGE_NAME=libopencv-android-${{ matrix.abi }}" >> "$GITHUB_ENV"
- name: setup ffmpeg
run: |
wget -q -O ffmpeg.tar.xz https://sourceforge.net/projects/avbuild/files/android/ffmpeg-6.1-android-lite.tar.xz
mkdir -p tmp
tar xf ffmpeg.tar.xz -C tmp --strip-components=1

mkdir -p $FFMPEG_ROOT
cp -rf tmp/include $FFMPEG_ROOT
cp -rf tmp/lib/${{ matrix.abi }} $FFMPEG_ROOT/lib
cp -rf tmp/bin/${{ matrix.abi }} $FFMPEG_ROOT/bin
cp -rf tmp/COPYING.LGPLv2.1 $FFMPEG_ROOT
cp -rf tmp/RELEASE_NOTES $FFMPEG_ROOT

mkdir -p $FFMPEG_ROOT/cmake
cp -rf ${{ github.workspace }}/cmake/ffmpeg-config.cmake $FFMPEG_ROOT/cmake/

rm -rf tmp
- name: build
run: |
cd ${{ env.SOURCE_DIR }}
mkdir build && cd build
cmake `cat ${{ github.workspace }}/options.txt` \
${{ env.COMMON_CMAKE_OPTIONS }} -S .. \
-DFFMPEG_DIR="$FFMPEG_ROOT/cmake" \
-DFFMPEG_ARCH="${{ matrix.abi }}"
cmake --build . -j $(nproc)
cmake --build . --target install

- name: package
run: |
mkdir -p ${{ env.PACKAGE_NAME }}/
cp -rf ${{ env.SOURCE_DIR }}/build/install/* ${{ env.PACKAGE_NAME }}/

cp -rf $FFMPEG_ROOT ${{ env.PACKAGE_NAME }}/ffmpeg

tar -C ${{ env.PACKAGE_NAME }} -zcvf ${{ env.PACKAGE_NAME }}.tar.gz .
- name: test
run: |
cd test
mkdir build && cd build
cmake ${{ env.COMMON_CMAKE_OPTIONS }} \
-DANDROID_ABI="${{ matrix.abi }}" \
-DANDROID_ARM_NEON=ON \
-DOpenCV_DIR=${{ github.workspace }}/${{ env.PACKAGE_NAME }}/sdk/native/jni \
-DFFMPEG_DIR="$FFMPEG_ROOT/cmake" \
..
cmake --build . -j $(nproc)
- name: upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_NAME }}.tar.gz
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: false
files: |
${{ env.PACKAGE_NAME }}.tar.gz
252 changes: 252 additions & 0 deletions .github/workflows/apple.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
name: apple
# on: pull_request
on:
push:
tags:
- "*"
pull_request:
branches: ["main"]

env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
IOS_DEPLOYMENT_TARGET: "11.0"
MAC_DEPLOYMENT_TARGET: "10.15"
ENABLE_BITCODE: OFF
ENABLE_ARC: OFF
ENABLE_VISIBILITY: OFF
FFMPEG_ROOT: /tmp/ffmpeg

jobs:
ios:
runs-on: macos-14
strategy:
matrix:
opencv-version: [4.10.0]
env:
COMMON_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOPENCV_EXTRA_MODULES_PATH="${{ github.workspace }}/opencv_contrib/modules" \
-DBUILD_TIFF=OFF \
-DBUILD_OPENJPEG=OFF \
-DWITH_OPENCL=OFF \
-DWITH_OPENCL_SVM=OFF \
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW \
steps:
- uses: actions/checkout@v4
- name: setup-opencv-source
run: |
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv.git opencv
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv_contrib.git opencv_contrib
echo "SOURCE_DIR=${{ github.workspace }}/opencv" >> "$GITHUB_ENV"
echo "PACKAGE_NAME=libopencv-ios-arm64" >> "$GITHUB_ENV"
echo "OPENCV_SUBDIR=lib/cmake/opencv4" >> "$GITHUB_ENV"
- name: setup ffmpeg
run: |
wget -q -O ffmpeg.tar.xz https://sourceforge.net/projects/avbuild/files/iOS/ffmpeg-6.1-iOS-lite-shared.tar.xz
mkdir -p $FFMPEG_ROOT
tar xf ffmpeg.tar.xz -C $FFMPEG_ROOT --strip-components=1
mkdir -p $FFMPEG_ROOT/cmake
cp -rf ${{ github.workspace }}/cmake/ffmpeg-config.cmake $FFMPEG_ROOT/cmake/
- name: build
run: |
cd ${{ env.SOURCE_DIR }}
mkdir build && cd build
cmake `cat ${{ github.workspace }}/options.txt` \
${{ env.COMMON_CMAKE_OPTIONS }} -S .. \
-DPLATFORM=OS64 \
-DFFMPEG_DIR="$FFMPEG_ROOT/cmake"
cmake --build . -j 4
cmake --build . --target install
- name: package
run: |
mkdir -p ${{ env.PACKAGE_NAME }}/
cp -rf ${{ env.SOURCE_DIR }}/build/install/* ${{ env.PACKAGE_NAME }}/

cp -rf $FFMPEG_ROOT ${{ env.PACKAGE_NAME }}/ffmpeg

tar -C ${{ env.PACKAGE_NAME }} -zcvf ${{ env.PACKAGE_NAME }}.tar.gz .
- name: test
run: |
cd test
mkdir build && cd build
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -S .. \
-DPLATFORM=OS64 \
-DFFMPEG_DIR="$FFMPEG_ROOT/cmake" \
-DOpenCV_DIR=${{ github.workspace }}/${{ env.PACKAGE_NAME }}/${{ env.OPENCV_SUBDIR }}
cmake --build . -j 4
- name: upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_NAME }}.tar.gz
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: false
files: |
${{ env.PACKAGE_NAME }}.tar.gz

ios-simulator:
runs-on: macos-14
strategy:
matrix:
opencv-version: [4.10.0]
platform:
- { arch: x64, name: SIMULATOR64 }
- { arch: arm64, name: SIMULATORARM64 }
env:
COMMON_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOPENCV_EXTRA_MODULES_PATH="${{ github.workspace }}/opencv_contrib/modules" \
-DBUILD_TIFF=OFF \
-DBUILD_OPENJPEG=OFF \
-DWITH_OPENCL=OFF \
-DWITH_OPENCL_SVM=OFF \
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW \
steps:
- uses: actions/checkout@v4
- name: setup-opencv-source
run: |
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv.git opencv
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv_contrib.git opencv_contrib
echo "SOURCE_DIR=${{ github.workspace }}/opencv" >> "$GITHUB_ENV"
echo "PACKAGE_NAME=libopencv-iossimulator-${{ matrix.platform.arch }}" >> "$GITHUB_ENV"
echo "OPENCV_SUBDIR=lib/cmake/opencv4" >> "$GITHUB_ENV"
- name: setup ffmpeg
run: |
wget -q -O ffmpeg.tar.xz https://sourceforge.net/projects/avbuild/files/iOSSimulator/ffmpeg-6.1-iOSSimulator-lite-shared.tar.xz
mkdir -p $FFMPEG_ROOT
tar xf ffmpeg.tar.xz -C $FFMPEG_ROOT --strip-components=1
mkdir -p $FFMPEG_ROOT/cmake
cp -rf ${{ github.workspace }}/cmake/ffmpeg-config.cmake $FFMPEG_ROOT/cmake/
- name: build
run: |
cd ${{ env.SOURCE_DIR }}
mkdir build && cd build
cmake `cat ${{ github.workspace }}/options.txt` \
${{ env.COMMON_CMAKE_OPTIONS }} -S .. \
-DPLATFORM=${{ matrix.platform.name }} \
-DFFMPEG_DIR="$FFMPEG_ROOT/cmake" \
-DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON
cmake --build . -j 4
cmake --build . --target install
- name: package
run: |
mkdir -p ${{ env.PACKAGE_NAME }}/
cp -rf ${{ env.SOURCE_DIR }}/build/install/* ${{ env.PACKAGE_NAME }}/

cp -rf $FFMPEG_ROOT ${{ env.PACKAGE_NAME }}/ffmpeg

tar -C ${{ env.PACKAGE_NAME }} -zcvf ${{ env.PACKAGE_NAME }}.tar.gz .
- name: test
run: |
cd test
mkdir build && cd build
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -S .. \
-DPLATFORM=${{ matrix.platform.name }} \
-DFFMPEG_DIR="$FFMPEG_ROOT/cmake" \
-DOpenCV_DIR=${{ github.workspace }}/${{ env.PACKAGE_NAME }}/${{ env.OPENCV_SUBDIR }}
cmake --build . -j 4
- name: upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_NAME }}.tar.gz
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: false
files: |
${{ env.PACKAGE_NAME }}.tar.gz

macos:
strategy:
matrix:
opencv-version: [4.10.0]
osname:
- { os: macos-13, arch: x64, platform: MAC }
- { os: macos-14, arch: arm64, platform: MAC_ARM64 }
runs-on: ${{ matrix.osname.os }}
env:
COMMON_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/cmake/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=OFF \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOPENCV_EXTRA_MODULES_PATH="${{ github.workspace }}/opencv_contrib/modules" \
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW \
steps:
- uses: actions/checkout@v4
- name: setup-opencv-source
run: |
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv.git opencv
git clone -b ${{ matrix.opencv-version }} https://github.com/opencv/opencv_contrib.git opencv_contrib
echo "SOURCE_DIR=${{ github.workspace }}/opencv" >> "$GITHUB_ENV"
echo "PACKAGE_NAME=libopencv-macos-${{ matrix.osname.arch }}" >> "$GITHUB_ENV"
echo "OPENCV_SUBDIR=lib/cmake/opencv4" >> "$GITHUB_ENV"
- name: setup ffmpeg
run: |
wget -q -O ffmpeg.tar.xz https://sourceforge.net/projects/avbuild/files/macOS/ffmpeg-6.1-macOS-lite.tar.xz
mkdir -p $FFMPEG_ROOT
tar xf ffmpeg.tar.xz -C $FFMPEG_ROOT --strip-components=1
mkdir -p $FFMPEG_ROOT/cmake
cp -rf ${{ github.workspace }}/cmake/ffmpeg-config.cmake $FFMPEG_ROOT/cmake/
- name: build
run: |
cd ${{ env.SOURCE_DIR }}
mkdir build && cd build
cmake `cat ${{ github.workspace }}/options.txt` \
${{ env.COMMON_CMAKE_OPTIONS }} -S .. \
-DPLATFORM=${{ matrix.osname.platform }} \
-DFFMPEG_DIR="$FFMPEG_ROOT/cmake"
cmake --build . -j 4
cmake --build . --target install
- name: package
run: |
mkdir -p ${{ env.PACKAGE_NAME }}/
cp -rf ${{ env.SOURCE_DIR }}/build/install/* ${{ env.PACKAGE_NAME }}/

cp -rf $FFMPEG_ROOT ${{ env.PACKAGE_NAME }}/ffmpeg

tar -C ${{ env.PACKAGE_NAME }} -zcvf ${{ env.PACKAGE_NAME }}.tar.gz .
- name: test
run: |
cd test
mkdir build && cd build
cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=${{ matrix.osname.platform }} \
-DFFMPEG_DIR="$FFMPEG_ROOT/cmake" \
-DOpenCV_DIR=${{ github.workspace }}/${{ env.PACKAGE_NAME }}/${{ env.OPENCV_SUBDIR }} \
..
cmake --build . -j 4
- name: upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_NAME }}.tar.gz
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
prerelease: false
files: |
${{ env.PACKAGE_NAME }}.tar.gz
Loading