Skip to content

Commit

Permalink
Upgrade FFmpeg to 6.0, OpenCV to 4.8.0
Browse files Browse the repository at this point in the history
Support Full-Static build

	modified:   .github/workflows/build-cpu-static-linux-x64.yml
	modified:   Build/Docker/cpu/base.Dockerfile
	modified:   Build/Docker/cpu/build.Dockerfile
	modified:   Build/Docker/cpu/build.sh
	modified:   Build/Docker/cpu/build_base.sh
	deleted:    Build/Docker/cpu_static/Dockerfile
	modified:   Build/Docker/cpu_static/build.Dockerfile
	modified:   Build/Docker/cpu_static/build.sh
	modified:   Build/Docker/cuda/build_base_cuda.sh
	modified:   Build/Docker/cuda/build_cuda.Dockerfile
	modified:   Build/Docker/cuda/build_cuda.sh
	modified:   Components/FFMPEGVideo/FFMPEGVideo.h
  • Loading branch information
eritpchy committed Sep 18, 2023
1 parent ec0eee8 commit 5b43643
Show file tree
Hide file tree
Showing 29 changed files with 330 additions and 104 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-cpu-linux-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ jobs:
cat Interfaces/VideoSubFinderWXW/MyResource.h| grep VSF_VERSION | sed -E 's/.+VSF_VERSION.+"(.+)"/release_version=\1/g' >> $GITHUB_ENV
-
name: Build cpu
run: bash ./Build/Docker/build.sh
run: bash ./Build/Docker/cpu/build.sh
-
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: videosubfinder-cli-cpu-linux-x64.tar.gz
path: |
./Build/Docker/build/cpu/videosubfinder-cli-cpu-linux-x64.tar.gz
./Build/Docker/cpu/out/videosubfinder-cli-cpu-linux-x64.tar.gz
-
name: Release draft
uses: softprops/action-gh-release@v1
Expand All @@ -61,5 +61,5 @@ jobs:
name: "${{ env.release_version }}"
tag_name: "${{ env.release_version }}-ci"
files: |
./Build/Docker/build/cpu/videosubfinder-cli-cpu-linux-x64.tar.gz
./Build/Docker/cpu/out/videosubfinder-cli-cpu-linux-x64.tar.gz
body: "[Github Action](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"
68 changes: 68 additions & 0 deletions .github/workflows/build-cpu-static-linux-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

name: Build CPU Static Linux X64

permissions:
contents: write
# Controls when the action will run.
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
# schedule:
# - cron: "0 0 * * */3"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Test scenario tags'

env:
TZ: Asia/Shanghai

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
buildx:
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Get current date
id: date
run: echo "::set-output name=today::$(date +'%Y%m%d')"
-
name: Assign release version
run: |
cat Interfaces/VideoSubFinderWXW/MyResource.h| grep VSF_VERSION | sed -E 's/.+VSF_VERSION.+"(.+)"/release_version=\1/g' >> $GITHUB_ENV
-
name: Build cpu-static
run: bash ./Build/Docker/cpu_static/build.sh
-
name: Test
run: bash ./Build/Docker/cpu_static/test.sh
-
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: videosubfinder-cli-cpu-linux-x64.tar.gz
path: |
./Build/Docker/cpu_static/out/videosubfinder-cli-cpu-static-linux-x64.tar.gz
-
name: Release draft
uses: softprops/action-gh-release@v1
with:
draft: true
name: "${{ env.release_version }}"
tag_name: "${{ env.release_version }}-ci"
files: |
./Build/Docker/cpu_static/out/videosubfinder-cli-cpu-static-linux-x64.tar.gz
body: "[Github Action](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"
6 changes: 3 additions & 3 deletions .github/workflows/build-cuda-linux-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ jobs:
cat Interfaces/VideoSubFinderWXW/MyResource.h| grep VSF_VERSION | sed -E 's/.+VSF_VERSION.+"(.+)"/release_version=\1/g' >> $GITHUB_ENV
-
name: Build cuda
run: bash ./Build/Docker/build_cuda.sh
run: bash ./Build/Docker/cuda/build_cuda.sh
-
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: videosubfinder-cli-cuda-linux-x64.tar.gz
path: |
./Build/Docker/build/cuda/videosubfinder-cli-cuda-linux-x64.tar.gz
./Build/Docker/cuda/out/videosubfinder-cli-cuda-linux-x64.tar.gz
-
name: Release draft
uses: softprops/action-gh-release@v1
Expand All @@ -61,5 +61,5 @@ jobs:
name: "${{ env.release_version }}"
tag_name: "${{ env.release_version }}-ci"
files: |
./Build/Docker/build/cuda/videosubfinder-cli-cuda-linux-x64.tar.gz
./Build/Docker/cuda/out/videosubfinder-cli-cuda-linux-x64.tar.gz
body: "[Github Action](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})"
52 changes: 24 additions & 28 deletions .github/workflows/build-darwin-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
cd Build && \
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_CUDA=OFF -DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ -DLIBCXX_ENABLE_PARALLEL_ALGORITHMS=YES \
-DFFMPEG_INCLUDE_DIRS=$(readlink -f /usr/local/Cellar/ffmpeg/5*/include) \
-DFFMPEG_INCLUDE_DIRS=$(readlink -f /usr/local/Cellar/ffmpeg/6*/include) \
-DPSTL_PARALLEL_BACKEND="tbb" -DCMAKE_CXX_FLAGS=-isystem\ $(readlink -f /usr/local/Cellar/tbb/2*/include) .. && \
make VERBOSE=1 -j$(nproc) && \
true
Expand All @@ -82,32 +82,35 @@ jobs:
mkdir work && \
mkdir work/lib && \
cd work && \
cp -fv /usr/local/lib/libwx_baseu-3.2.0.2.1.dylib lib/ || true; \
cp -fv /usr/local/lib/libopencv_videoio.407.dylib lib/ || true; \
cp -fv /usr/local/lib/libavcodec.59.dylib lib/ || true; \
cp -fv /usr/local/lib/libavformat.59.dylib lib/ || true; \
cp -fv /usr/local/lib/libavutil.57.dylib lib/ || true; \
cp -fv /usr/local/lib/libswscale.6.dylib lib/ || true; \
cp -fv /usr/local/lib/libavfilter.8.dylib lib/ || true; \
cp -fv /usr/local/lib/libtbb.12.dylib lib/ || true; \
cp -fv /usr/local/lib/libwx_osx_cocoau_core-3.2.dylib lib/ || true; \
cp -fv /usr/local/lib/libopencv_imgcodecs.407.dylib lib/ || true; \
cp -fv /usr/local/lib/libopencv_imgproc.407.dylib lib/ || true; \
cp -fv /usr/local/lib/libopencv_core.407.dylib lib/ || true; \
otool -l ../Interfaces/VideoSubFinderCli/VideoSubFinderCli && \
cp -fv /usr/local/lib/libwx_baseu-3.?.?.?.?.dylib lib/; \
cp -fv /usr/local/lib/libopencv_videoio.???.dylib lib/; \
cp -fv /usr/local/lib/libavcodec.??.dylib lib/; \
cp -fv /usr/local/lib/libavformat.??.dylib lib/; \
cp -fv /usr/local/lib/libavutil.??.dylib lib/; \
cp -fv /usr/local/lib/libswscale.?.dylib lib/; \
cp -fv /usr/local/lib/libavfilter.?.dylib lib/; \
cp -fv /usr/local/Cellar/libarchive/*/lib/libarchive.??.dylib lib/; \
cp -fv /usr/local/lib/libtbb.??.dylib lib/; \
cp -fv /usr/local/lib/libwx_osx_cocoau_core-3.?.dylib lib/; \
cp -fv /usr/local/lib/libopencv_imgcodecs.???.dylib lib/ ; \
cp -fv /usr/local/lib/libopencv_imgproc.???.dylib lib/; \
cp -fv /usr/local/lib/libopencv_core.???.dylib lib/; \
cp -fv /usr/local/lib/libsystem_pthread.dylib lib/ || true; \
cp -fv /usr/local/lib/liblzma.5.dylib lib/ || true; \
cp -fv /usr/local/lib/libGIF.dylib lib/ || true; \
cp -fv /usr/local/lib/libpcre2-32.0.dylib lib/ || true; \
cp -fv /usr/local/lib/libjpeg.8.dylib lib/ || true; \
cp -fv /usr/local/lib/libwebp.7.dylib lib/ || true; \
cp -fv /usr/local/lib/libpng16.16.dylib lib/ || true; \
cp -fv /usr/local/lib/libtiff.5.dylib lib/ || true; \
cp -fv /usr/local/lib/libtiff.?.dylib lib/; \
cp -fv /usr/local/lib/libopenjp2.7.dylib lib/ || true; \
cp -fv /usr/local/lib/libOpenEXR-3_1.30.dylib lib/ || true; \
cp -fv /usr/local/lib/libImath-3_1.30.dylib lib/ || true; \
cp -fv /usr/local/lib/libIlmThread-3_1.30.dylib lib/ || true; \
cp -fv /usr/local/lib/libIex-3_1.30.dylib lib/ || true; \
cp -fv /usr/local/lib/libopenblas.0.dylib lib/ || true; \
cp -fv /usr/local/lib/libOpenEXR-?_?.??.dylib lib/; \
cp -fv /usr/local/lib/libOpenEXRCore-?_?.??.dylib lib/; \
cp -fv /usr/local/lib/libImath-?_?.??.dylib lib/; \
cp -fv /usr/local/lib/libIlmThread-?_?.??.dylib lib/; \
cp -fv /usr/local/lib/libIex-?_?.??.dylib lib/; \
cp -fv /usr/local/Cellar/openblas/*/lib/libopenblas.?.dylib lib/; \
cp -fv /usr/local/lib/libgfortran.5.dylib lib/ || true; \
cp -fv /usr/local/lib/libgomp.1.dylib lib/ || true; \
cp -fv /usr/local/lib/libquadmath.0.dylib lib/ || true; \
Expand Down Expand Up @@ -166,7 +169,7 @@ jobs:
cp -fv /usr/local/lib/libssl.1.1.dylib lib/ || true; \
cp -fv /usr/local/lib/libcrypto.1.1.dylib lib/ || true; \
cp -fv /usr/local/lib/libsodium.23.dylib lib/ || true; \
cp -fv /usr/local/lib/libpostproc.56.dylib lib/ || true; \
cp -fv /usr/local/lib/libpostproc.??.dylib lib/; \
cp -fv /usr/local/lib/librubberband.2.dylib lib/ || true; \
cp -fv /usr/local/lib/libsamplerate.0.dylib lib/ || true; \
cp -fv /usr/local/lib/libtesseract.5.dylib lib/ || true; \
Expand All @@ -190,21 +193,14 @@ jobs:
type: 'tar'
filename: 'videosubfinder-cli-darwin-x64.tar.gz'
directory: 'Build/work'
path: "./VideoSubFinderCli"
path: "./*"
-
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: videosubfinder-cli-darwin-x64.tar.gz
path: |
./Build/work/videosubfinder-cli-darwin-x64.tar.gz
-
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dependencies.tar.gz
path: |
./Build/work/lib
-
name: Release draft
uses: softprops/action-gh-release@v1
Expand Down
4 changes: 2 additions & 2 deletions Build/Darwin_x64/VideoSubFinderCli.run
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
cd ${0%/*}
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PWD/lib:/lib64
cd "${0%/*}"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$PWD/lib:/lib64"
chmod +x ./VideoSubFinderCli
./VideoSubFinderCli "$@"
12 changes: 0 additions & 12 deletions Build/Docker/build.sh

This file was deleted.

5 changes: 3 additions & 2 deletions Build/Docker/build_all.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
set -e
cd ${0%/*}
./build.sh
./build_cuda.sh
./cpu/build.sh
./cpu_static/build.sh
./cuda/build_cuda.sh
12 changes: 0 additions & 12 deletions Build/Docker/build_cuda.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN mkdir -p /tmp/work \
&& cd /tmp/work \
&& git clone https://github.com/wxWidgets/wxWidgets.git \
&& cd wxWidgets/ \
&& git checkout v3.2.1 \
&& git checkout v3.2.2.1 \
&& git submodule update --init --recursive \
&& mkdir buildgtk \
&& cd buildgtk/ \
Expand All @@ -22,15 +22,13 @@ RUN mkdir -p /tmp/work \
&& make install \
&& rm -rf /tmp/work/wxWidgets
RUN cd /tmp/work \
&& wget https://github.com/opencv/opencv/archive/4.7.0.tar.gz \
&& tar xvf 4.7.0.tar.gz \
&& cd opencv-4.7.0/ \
&& git clone https://github.com/opencv/opencv.git -b 4.8.0 --depth=1 \
&& cd opencv \
&& mkdir -p build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DWITH_GTK=OFF -DWITH_FFMPEG=ON -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_OPENGL=ON \
-D WITH_CUBLAS=ON -DWITH_QT=OFF -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" .. \
&& cmake --build . --config Release -j $(nproc) \
&& make install \
&& rm -rf /tmp/work/opencv-4.7.0 \
&& rm -f /tmp/work/4.7.0.tar.gz
&& rm -rf /tmp/work/opencv
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM eritpchy/videosubfinder-build:base
COPY . /tmp/work/videosubfinder-src

RUN cd /tmp/work/videosubfinder-src \
&& cp -rf ./Build/Linux_x64/* /tmp/work/ \
&& rm -rf linux_build \
Expand All @@ -10,11 +9,11 @@ RUN cd /tmp/work/videosubfinder-src \
&& cmake --build . --config Release -j $(nproc) \
&& cp ./Interfaces/VideoSubFinderCli/VideoSubFinderCli /tmp/work/ \
&& rm -rf /tmp/work/videosubfinder-src
RUN cp -L /usr/local/lib/libwx_baseu-3.2.so.0 \
/usr/local/lib/libopencv_videoio.so.407 \
/usr/local/lib/libopencv_core.so.407 \
/usr/local/lib/libopencv_imgproc.so.407 \
/usr/local/lib/libopencv_imgcodecs.so.407 \
RUN cp -L /usr/local/lib/libwx_baseu-?.?.so.? \
/usr/local/lib/libopencv_videoio.so.??? \
/usr/local/lib/libopencv_core.so.??? \
/usr/local/lib/libopencv_imgproc.so.??? \
/usr/local/lib/libopencv_imgcodecs.so.??? \
/tmp/work/


Expand Down
12 changes: 12 additions & 0 deletions Build/Docker/cpu/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e
cd ${0%/*}
if [[ "$GITHUB_ACTION" ]]; then
docker buildx build --cache-from type=gha --cache-to type=gha,mode=max \
-t videosubfinder-build:cpu -f build.Dockerfile ../../..
else
docker build -t videosubfinder-build:cpu -f build.Dockerfile ../../..
fi
mkdir -p out
docker run --rm -v $PWD/out:$PWD/out videosubfinder-build:cpu \
bash -c "cd /tmp/work/ && tar cvzf $PWD/out/videosubfinder-cli-cpu-linux-x64.tar.gz *"
File renamed without changes.
53 changes: 53 additions & 0 deletions Build/Docker/cpu_static/base.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM ubuntu:20.04 as builder
# Allow ubuntu to cache package downloads
RUN rm -f /etc/apt/apt.conf.d/docker-clean
ARG USE_GUI=0
RUN --mount=type=cache,target=/var/cache/apt \
apt update
RUN --mount=type=cache,target=/var/cache/apt \
DEBIAN_FRONTEND=noninteractive apt install -y ccache build-essential curl git
ENV PATH="/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/tmp/work/ffmpeg-build-script/workspace/bin"
RUN mkdir -p /tmp/work
RUN --mount=type=cache,target=/root/.ccache \
cd /tmp/work/ \
&& git clone https://github.com/markus-perl/ffmpeg-build-script.git -b master --depth=1 \
&& cd ffmpeg-build-script \
&& AUTOINSTALL="yes" ./build-ffmpeg --enable-gpl-and-non-free --build --full-static \
&& true
RUN --mount=type=cache,target=/root/.ccache \
cd /tmp/work \
&& git clone https://github.com/wxWidgets/wxWidgets.git -b v3.2.2.1 --depth=1 --recurse-submodules -j8 \
&& cd wxWidgets/ \
&& mkdir buildgtk \
&& cd buildgtk/ \
&& ../configure --disable-gui --disable-shared --disable-sys-libs \
&& make -j$(nproc) \
&& make install \
&& rm -rf /tmp/work/wxWidgets \
&& true
RUN --mount=type=cache,target=/root/.ccache \
cd /tmp/work \
&& git clone https://github.com/opencv/opencv.git -b 4.8.0 --depth=1 \
&& cd opencv \
&& mkdir -p build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DWITH_GTK=OFF -DWITH_FFMPEG=ON -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_OPENGL=ON \
-D WITH_CUBLAS=ON -DWITH_QT=OFF -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" -DBUILD_SHARED_LIBS=OFF .. \
&& cmake --build . --config Release -j $(nproc) \
&& make install \
&& rm -rf /tmp/work/opencv \
&& true
# OpenCV full staitc library
RUN grep -R -l "\.so" /usr/local/lib/cmake/opencv4/*.cmake | xargs -I{} sed -i 's/\.so/.a/g' {}

RUN --mount=type=cache,target=/root/.ccache \
cd /tmp/work \
&& git clone https://github.com/oneapi-src/oneTBB.git -b v2020.3.3 --depth=1 \
&& cd oneTBB \
&& make tbb_build_prefix=BUILDPREFIX extra_inc=big_iron.inc \
&& cp -f ./build/BUILDPREFIX_release/libtbb.a /usr/local/lib/ \
&& cp -f ./build/BUILDPREFIX_release/libtbbmalloc.a /usr/local/lib \
&& cp -rf ./include/tbb /usr/local/include/ \
&& rm -rf /tmp/work/oneTBB \
&& true
Loading

0 comments on commit 5b43643

Please sign in to comment.