Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9c41e28
transcoder: enable copy mode only the 'copy' is selected
JackLau1222 Nov 11, 2025
51707ba
AI Processing Support: Real-ESRGAN model powered by BMF
JackLau1222 Nov 12, 2025
fc86e5a
feat: Add Python bundling and simplify library bundling workflow
JackLau1222 Nov 20, 2025
c4ec768
cicd: add support bmf build for mac
JackLau1222 Nov 20, 2025
0e8667e
ui: only compile AI related component when bmf and gui enabled
JackLau1222 Nov 22, 2025
5fa08ed
cicd: remove the binutils and ncurses package
JackLau1222 Nov 22, 2025
fbd41e6
transcoder_bmf: add default codec
JackLau1222 Nov 22, 2025
053b31d
transcoder_bmf: fix the abnormal progress show when ai processing
JackLau1222 Nov 22, 2025
51da2cd
ai_processing_page: add auto format selector
JackLau1222 Nov 22, 2025
ac49b27
cmakelists: delete unneccessary install code
JackLau1222 Nov 22, 2025
a8f84bb
cicd: remove bintutils and ncurses libs
JackLau1222 Nov 22, 2025
fe47633
python_manager: add python package for linux platform
JackLau1222 Nov 23, 2025
f0ea4fb
f
JackLau1222 Nov 23, 2025
c832e55
ai_processing_page: only set codec when user specific
JackLau1222 Nov 24, 2025
4caffe9
enhance_module: fix the torch backend mps can't found on other platform
JackLau1222 Nov 24, 2025
71256e3
requirements: simplify the package
JackLau1222 Nov 27, 2025
984ba63
python_manager: install python into app data path rather than bundle
JackLau1222 Nov 28, 2025
1513eda
f
JackLau1222 Nov 28, 2025
3889ca4
cd: use macos-14 runner for compatibility
JackLau1222 Nov 28, 2025
698868e
enable bmf
JackLau1222 Nov 28, 2025
b0277d8
cd: directly get bmf package rather than build it
JackLau1222 Nov 28, 2025
4805f31
fix_macos_libs: fix libbuiltin_modules can't find libavdevice
JackLau1222 Nov 28, 2025
3a5d461
test: build bmf rather than directly get it
JackLau1222 Nov 28, 2025
9b8c775
set BMF_ROOT_PATH
JackLau1222 Nov 28, 2025
778cf8d
bundle python itself into .app
JackLau1222 Nov 28, 2025
2943088
fix the missing codesign
JackLau1222 Nov 28, 2025
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
97 changes: 93 additions & 4 deletions .augment-guidelines
Original file line number Diff line number Diff line change
Expand Up @@ -254,21 +254,110 @@ All source files (doesn't inlcude FFmpeg code) should include Apache 2.0 license

### Building the Project

OpenConverter supports two build modes:

#### **Debug Mode (Development)**
Fast builds for development, uses system libraries:

```bash
# Create build directory
mkdir build && cd build

# Configure with CMake
cmake ../src -DENABLE_GUI=ON
# Configure (Debug is default)
cmake ../src -DENABLE_GUI=ON -DBMF_TRANSCODER=ON

# Build
make -j4

# Run
./OpenConverter # GUI mode
./OpenConverter --help # CLI mode
./OpenConverter.app/Contents/MacOS/OpenConverter # macOS
./OpenConverter # Linux
```

**What's bundled:**
- ✅ Python modules (`enhance_module.py`)
- ✅ AI model weights (2.4 MB)
- ❌ BMF libraries (uses system BMF from CMake path)
- ❌ Qt frameworks (uses system Qt)
- ❌ Python runtime (uses system Python)

**Requirements:**
- Python 3.9+ with PyTorch, Real-ESRGAN, OpenCV, NumPy
- BMF framework (path configured in CMake)
- Qt 5.15+ (for GUI)

**Environment:** No environment variables needed! BMF path is detected from CMake configuration.

#### **Release Mode (Distribution)**
Standalone builds for distribution, bundles everything:

```bash
# Create separate build directory
mkdir build-release && cd build-release

# Configure with Release mode
cmake ../src -DCMAKE_BUILD_TYPE=Release -DENABLE_GUI=ON -DBMF_TRANSCODER=ON

# Build (takes longer due to bundling)
make -j4

# Run - NO environment variables needed!
open OpenConverter.app # macOS
./OpenConverter # Linux
```

**What's bundled:**
- ✅ Python modules
- ✅ AI model weights (2.4 MB)
- ✅ BMF libraries (25+ libraries, ~30 MB)
- ✅ Qt frameworks (10+ frameworks, ~150 MB)
- ✅ Python runtime with PyTorch, Real-ESRGAN, OpenCV, NumPy (~30 MB)
- ✅ FFmpeg libraries (~25 MB)

**Total Size:** ~800 MB - 1.2 GB (fully standalone)

**Advantages:**
- ✅ Fully standalone (no dependencies)
- ✅ Works on any Mac (macOS 11+)
- ✅ No environment variables needed
- ✅ Ready for distribution (zip/DMG)

### Library Bundling (macOS Release Mode)

**Important:** All library bundling (Qt, FFmpeg, BMF) is handled by **`tool/fix_macos_libs.sh`**, NOT by CMake.

#### **Workflow**

1. **Build**: `cmake -B build-release -DCMAKE_BUILD_TYPE=Release && cd build-release && make -j4`
2. **Bundle**: `cd .. && tool/fix_macos_libs.sh`

The script auto-detects build directory, bundles Qt/FFmpeg/BMF libraries, fixes paths, and code signs.

#### **BMF Library Structure**

```
OpenConverter.app/Contents/
├── Frameworks/
│ ├── lib/ # Builtin modules (BMF hardcoded path)
│ │ ├── libbuiltin_modules.dylib
│ │ ├── libcopy_module.dylib
│ │ └── libcvtcolor.dylib
│ ├── libbmf_module_sdk.dylib # Core BMF libraries
│ ├── libhmp.dylib
│ ├── _bmf.cpython-39-darwin.so
│ └── BUILTIN_CONFIG.json
└── Resources/bmf_python/ # BMF Python package
```

**Why `Frameworks/lib/`?** BMF expects builtin modules in `lib/` subdirectory relative to `BMF_MODULE_CONFIG_PATH`.

**Script Logic:**
- Auto-appends `/output/bmf` to `$BMF_ROOT_PATH` if needed (same as CMake)
- Copies builtin modules to `Frameworks/lib/`
- Copies core libraries to `Frameworks/`
- Processes both `.dylib` and `.so` files
- Fixes all paths to use `@executable_path`

### Translation Workflow

OpenConverter uses Qt Linguist tools for internationalization (i18n). Translation files are located in `src/resources/`.
Expand Down
31 changes: 30 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Build with CMake
run: |
export PATH=$PATH:$FFMPEG_ROOT_PATH/bin
(cd src && cmake -B build -DENABLE_TESTS=ON -DENABLE_GUI=OFF && cd build && make -j$(nproc))
(cd src && cmake -B build -DENABLE_TESTS=ON -DBMF_TRANSCODER=OFF -DENABLE_GUI=OFF && cd build && make -j$(nproc))

- name: Run tests
run: |
Expand Down Expand Up @@ -78,6 +78,35 @@ jobs:
$FFMPEG_ROOT_PATH/bin/ffmpeg -version | head -n 1
$FFMPEG_ROOT_PATH/bin/ffmpeg -encoders 2>/dev/null | grep -E "libx264|libx265" || echo "Warning: x264/x265 not found"

- name: Checkout BMF repository(specific branch)
run: |
git clone https://github.com/OpenConverterLab/bmf.git
cd bmf
git checkout oc

# wget https://invisible-island.net/archives/ncurses/ncurses-6.5.tar.gz
# wget https://ftp.gnu.org/gnu/binutils/binutils-2.43.1.tar.bz2

- name: Cache BMF build
uses: actions/cache@v3
with:
path: bmf/output/
key: ${{ runner.os }}-bmf-${{ hashFiles('bmf/build_osx.sh') }}
restore-keys: |
${{ runner.os }}-bmf-macos-arm-

- name: Set up BMF if not cached
run: |
if [ ! -d "$(pwd)/bmf/output/" ]; then
# export LIBRARY_PATH=$(pwd)/opt/binutils/lib:$LIBRARY_PATH
# export CMAKE_PREFIX_PATH=$(pwd)/opt/binutils:$CMAKE_PREFIX_PATH
pip install setuptools
(cd bmf && git checkout oc && git submodule update --init --recursive && ./build_osx.sh)
else
echo "BMF is already installed, skipping build."
fi
echo "BMF_ROOT_PATH=$(pwd)/bmf/output/bmf" >> $GITHUB_ENV

- name: Build with CMake
run: |
export PATH=$PATH:$FFMPEG_ROOT_PATH/bin
Expand Down
73 changes: 35 additions & 38 deletions .github/workflows/review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,10 @@
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
echo "Current commit hash: $(git rev-parse HEAD)"

- name: Checkout BMF repository (specific branch)
- name: Install dependencies
run: |
# sudo apt update
# sudo apt install -y make git pkg-config libssl-dev cmake binutils-dev libgoogle-glog-dev gcc g++ golang wget libgl1
sudo apt install -y nasm yasm libx264-dev libx265-dev libnuma-dev
# sudo apt install -y python3.9 python3-dev python3-pip libsndfile1 libsndfile1-dev

git clone https://github.com/JackLau1222/bmf.git

# - name: Cache BMF build
# uses: actions/cache@v3
# with:
# path: bmf/output/
# key: ${{ runner.os }}-bmf-${{ hashFiles('bmf/build.sh') }}
# restore-keys: |
# ${{ runner.os }}-bmf-linux-x86
sudo apt update
sudo apt install -y make git pkg-config libssl-dev cmake binutils-dev libgoogle-glog-dev libunwind-dev gcc g++ golang wget libgl1

- name: Get FFmpeg
run: |
Expand All @@ -45,14 +33,11 @@
ls ffmpeg-n5.1.6-11-gcde3c5fc0c-linux64-gpl-shared-5.1
echo "FFMPEG_ROOT_PATH=$(pwd)/ffmpeg-n5.1.6-11-gcde3c5fc0c-linux64-gpl-shared-5.1" >> $GITHUB_ENV

# - name: Set up BMF if not cached
# run: |
# if [ ! -d "$(pwd)/bmf/output/" ]; then
# (cd bmf && git checkout fork_by_oc && ./build.sh)
# else
# echo "BMF is already installed, skipping build."
# fi
# echo "BMF_ROOT_PATH=$(pwd)/bmf/output/bmf" >> $GITHUB_ENV
- name: Get BMF
run: |
wget https://github.com/OpenConverterLab/bmf/releases/download/oc0.0.3/bmf-bin-linux-x86_64-cp39.tar.gz
tar xzvf bmf-bin-linux-x86_64-cp39.tar.gz
echo "BMF_ROOT_PATH=$(pwd)/output/bmf" >> $GITHUB_ENV

- name: Set up Qt
run: |
Expand All @@ -61,7 +46,7 @@
- name: Build with CMake
run: |
export PATH=$PATH:$FFMPEG_ROOT_PATH/bin
(cd src && cmake -B build -DBMF_TRANSCODER=OFF && cd build && make -j$(nproc))
(cd src && cmake -B build && cd build && make -j$(nproc))

- name: Copy libs
run: |
Expand All @@ -84,15 +69,15 @@
continue-on-error: true


# - name: Copy runtime
# run: |
# cp $FFMPEG_ROOT_PATH/lib/libswscale.so.6 src/build/lib
# cp $FFMPEG_ROOT_PATH/lib/libavfilter.so.8 src/build/lib
# cp $FFMPEG_ROOT_PATH/lib/libpostproc.so.56 src/build/lib
# cp $BMF_ROOT_PATH/lib/libbuiltin_modules.so src/build/lib
# cp $BMF_ROOT_PATH/BUILTIN_CONFIG.json src/build
# touch src/build/activate_env.sh
# echo export LD_LIBRARY_PATH="./lib" >> src/build/activate_env.sh
- name: Copy runtime
run: |
cp $FFMPEG_ROOT_PATH/lib/libswscale.so.6 src/build/lib
cp $FFMPEG_ROOT_PATH/lib/libavfilter.so.8 src/build/lib
cp $FFMPEG_ROOT_PATH/lib/libpostproc.so.56 src/build/lib
cp $BMF_ROOT_PATH/lib/libbuiltin_modules.so src/build/lib
cp $BMF_ROOT_PATH/BUILTIN_CONFIG.json src/build
touch src/build/activate_env.sh
echo export LD_LIBRARY_PATH="./lib" >> src/build/activate_env.sh

# Step to package the build directory
- name: Create tar.gz package
Expand Down Expand Up @@ -120,79 +105,91 @@
run: echo "Release upload complete"

build-macos-arm:
runs-on: macos-latest
runs-on: macos-14
concurrency:
group: "review-macos-${{ github.event.pull_request.number }}"
cancel-in-progress: true

steps:
- name: Checkout target branch code (using pull_request)
uses: actions/checkout@v2

- name: Print current branch and commit hash
run: |
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
echo "Current commit hash: $(git rev-parse HEAD)"

- name: Install FFmpeg and Qt via Homebrew
run: |
# Install FFmpeg 5 with x264, x265 support (pre-built from Homebrew)
brew install ffmpeg@5 qt@5
brew install ffmpeg@5 qt@5 [email protected]

# Set FFmpeg path
export FFMPEG_ROOT_PATH=$(brew --prefix ffmpeg@5)
echo "FFMPEG_ROOT_PATH=$FFMPEG_ROOT_PATH" >> $GITHUB_ENV

# Verify FFmpeg has x264 and x265
echo "FFmpeg configuration:"
$FFMPEG_ROOT_PATH/bin/ffmpeg -version | head -n 1
$FFMPEG_ROOT_PATH/bin/ffmpeg -encoders 2>/dev/null | grep -E "libx264|libx265" || echo "Warning: x264/x265 not found"

- name: Checkout BMF repository(specific branch)
run: |
git clone https://github.com/OpenConverterLab/bmf.git
brew link --force [email protected]
export BMF_PYTHON_VERSION="3.9"
(cd bmf && git checkout oc && git submodule update --init --recursive && ./build_osx.sh)
echo "BMF_ROOT_PATH=$(pwd)/bmf/output/bmf" >> $GITHUB_ENV

# wget https://github.com/OpenConverterLab/bmf/releases/download/oc0.0.3/bmf-bin-macOS-arm64-cp39.tar.gz
# tar xzvf bmf-bin-macOS-arm64-cp39.tar.gz
# echo "BMF_ROOT_PATH=$(pwd)/output/bmf" >> $GITHUB_ENV

- name: Build and Deploy
run: |
export PATH="$(brew --prefix ffmpeg@5)/bin:$PATH"
export CMAKE_PREFIX_PATH="$(brew --prefix qt@5):$CMAKE_PREFIX_PATH"
export QT_DIR="$(brew --prefix qt@5)/lib/cmake/Qt5"
export PATH="$(brew --prefix qt@5)/bin:$PATH"

cd src
cmake -B build \
cmake -B build -DCMAKE_BUILD_TYPE=Release \
-DFFMPEG_ROOT_PATH="$(brew --prefix ffmpeg@5)" \
-DBMF_TRANSCODER=OFF
-DBMF_TRANSCODER=ON

cd build
make -j$(sysctl -n hw.ncpu)

# Use the fix_macos_libs.sh script to handle deployment
cd ..
chmod +x ../tool/fix_macos_libs.sh
../tool/fix_macos_libs.sh

cd build

# Create DMG using simple shell script
echo "Creating DMG..."
chmod +x ../../tool/create_dmg_simple.sh
../../tool/create_dmg_simple.sh OpenConverter.app

cd ../..
mv src/build/OpenConverter.dmg OpenConverter_macOS_aarch64.dmg

# Step to upload the dmg package as an artifact
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: OpenConverter_macOS_aarch64
path: OpenConverter_macOS_aarch64.dmg

# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3

- name: Finish
run: echo "Release upload complete"

build-windows-x64:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: windows-latest
concurrency:
group: "review-win-${{ github.event.pull_request.number }}"
Expand Down Expand Up @@ -228,7 +225,7 @@
- name: Build Qt project
run: |
(cd src &&
cmake -S . -B build "-DFFMPEG_ROOT_PATH=../ffmpeg/ffmpeg-n5.1.6-11-gcde3c5fc0c-win64-gpl-shared-5.1" -DFFTOOL_TRANSCODER=OFF &&
cmake -S . -B build "-DFFMPEG_ROOT_PATH=../ffmpeg/ffmpeg-n5.1.6-11-gcde3c5fc0c-win64-gpl-shared-5.1" -DFFTOOL_TRANSCODER=OFF -DBMF_TRANSCODER=OFF &&
cmake --build build --config Release --parallel)

- name : Deploy project
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ src/build-*
build
.idea
workload_output.txt

# AI model weights (downloaded during build)
src/modules/weights/*.pth
src/modules/weights/*.onnx
src/modules/weights/*.pt
Loading
Loading