Skip to content
Closed
Show file tree
Hide file tree
Changes from 15 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
67 changes: 63 additions & 4 deletions .github/workflows/review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
- 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 python@3.9

# Set FFmpeg path
export FFMPEG_ROOT_PATH=$(brew --prefix ffmpeg@5)
Expand All @@ -148,6 +148,65 @@ 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

# 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 ncurses build
# uses: actions/cache@v3
# with:
# path: opt/ncurses
# key: ${{ runner.os }}-ncurses-${{ hashFiles('ncurses-6.5.tar.gz') }}
# restore-keys: |
# ${{ runner.os }}-ncurses-

# - name: Cache binutils build
# uses: actions/cache@v3
# with:
# path: opt/binutils
# key: ${{ runner.os }}-binutils-${{ hashFiles('binutils-2.43.1.tar.bz2') }}
# restore-keys: |
# ${{ runner.os }}-binutils-

# - name: compile dependencies
# run: |
# if [ ! -d "$(pwd)/opt/ncurses" ]; then
# tar -xzvf ncurses-6.5.tar.gz
# (cd ncurses-6.5 && ./configure --prefix=/Users/runner/work/OpenConverter/OpenConverter/opt/ncurses && make -j$(sysctl -n hw.ncpu) && sudo make install)
# else
# echo "ncurses is already installed, skipping build."
# fi

# if [ ! -d "$(pwd)/opt/binutils" ]; then
# tar xvf binutils-2.43.1.tar.bz2
# (cd binutils-2.43.1 && ./configure --prefix=/Users/runner/work/OpenConverter/OpenConverter/opt/binutils --enable-install-libiberty && make -j$(sysctl -n hw.ncpu) && sudo make install)
# else
# echo "binutils is already installed, skipping build."
# fi

- 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-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 and Deploy
run: |
export PATH="$(brew --prefix ffmpeg@5)/bin:$PATH"
Expand All @@ -156,9 +215,9 @@ jobs:
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)
Expand Down Expand Up @@ -228,7 +287,7 @@ jobs:
- 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