Skip to content

Commit 59a0feb

Browse files
authored
feat: add minimal AI processing support (#133)
* transcoder: enable copy mode only the 'copy' is selected * AI Processing Support: Real-ESRGAN model powered by BMF - Add enahnce_module.py (Real-ESRGAN), support GPU acceleration. - Both of GUI and CLI support call this AI feature. **Python Runtime Support:** - Add PythonManager for automatic Python environment setup - Add PythonInstallDialog for user-friendly installation UI - install Python runtime with PyTorch, Real-ESRGAN, OpenCV, NumPy - Download Python in App Path **BMF Integration:** - Add runtime BMF library path detection - Set BMF_MODULE_CONFIG_PATH and PYTHONPATH automatically - Support both system BMF (Debug) and bundled BMF (Release) * ui: only compile AI related component when bmf and gui enabled * ai_processing_page: only set codec when user specific * cd: use macos-14 runner for compatibility enable bmf on linux * cd: specific the python 3.9 for mac build * cd: add linux arm build * python_manager: set PATH and *_LIBRARY_PATH for python * force require App Python for linux platform(release or not) * cd: change the start entry to OpenConverter from AppRun This avoid wrong App Data Path by Qt. * transcoder_bmf: get module path from BMF_MODULE_PATH env * cd: add libavdevices.so.59 for linux build * cd: add build-linglong workflow job add linglong.yaml and dynamically build default.desktop * cd: get ll cache from docker * python_manager: install cpu-only support torch * cd: bundle the weight file for linux build * python_manager: install bmf package from github for linux build * cd: dynamically build the desktop file for ll * cd: use defualt icon for ll build * python_install_dialog: require user to restart app after python support installed * ui: dynamically build the page list Enable ai_processing page only if bmf is enabled * cd: merge review.yaml and release.yaml into build.yaml --------- Signed-off-by: Jack Lau <[email protected]> Signed-off-by: Jack Lau <[email protected]>
1 parent fec4186 commit 59a0feb

32 files changed

+3663
-686
lines changed

.augment-guidelines

Lines changed: 93 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,21 +254,110 @@ All source files (doesn't inlcude FFmpeg code) should include Apache 2.0 license
254254

255255
### Building the Project
256256

257+
OpenConverter supports two build modes:
258+
259+
#### **Debug Mode (Development)**
260+
Fast builds for development, uses system libraries:
261+
257262
```bash
258263
# Create build directory
259264
mkdir build && cd build
260265

261-
# Configure with CMake
262-
cmake ../src -DENABLE_GUI=ON
266+
# Configure (Debug is default)
267+
cmake ../src -DENABLE_GUI=ON -DBMF_TRANSCODER=ON
263268

264269
# Build
265270
make -j4
266271

267272
# Run
268-
./OpenConverter # GUI mode
269-
./OpenConverter --help # CLI mode
273+
./OpenConverter.app/Contents/MacOS/OpenConverter # macOS
274+
./OpenConverter # Linux
275+
```
276+
277+
**What's bundled:**
278+
- ✅ Python modules (`enhance_module.py`)
279+
- ✅ AI model weights (2.4 MB)
280+
- ❌ BMF libraries (uses system BMF from CMake path)
281+
- ❌ Qt frameworks (uses system Qt)
282+
- ❌ Python runtime (uses system Python)
283+
284+
**Requirements:**
285+
- Python 3.9+ with PyTorch, Real-ESRGAN, OpenCV, NumPy
286+
- BMF framework (path configured in CMake)
287+
- Qt 5.15+ (for GUI)
288+
289+
**Environment:** No environment variables needed! BMF path is detected from CMake configuration.
290+
291+
#### **Release Mode (Distribution)**
292+
Standalone builds for distribution, bundles everything:
293+
294+
```bash
295+
# Create separate build directory
296+
mkdir build-release && cd build-release
297+
298+
# Configure with Release mode
299+
cmake ../src -DCMAKE_BUILD_TYPE=Release -DENABLE_GUI=ON -DBMF_TRANSCODER=ON
300+
301+
# Build (takes longer due to bundling)
302+
make -j4
303+
304+
# Run - NO environment variables needed!
305+
open OpenConverter.app # macOS
306+
./OpenConverter # Linux
270307
```
271308

309+
**What's bundled:**
310+
- ✅ Python modules
311+
- ✅ AI model weights (2.4 MB)
312+
- ✅ BMF libraries (25+ libraries, ~30 MB)
313+
- ✅ Qt frameworks (10+ frameworks, ~150 MB)
314+
- ✅ Python runtime with PyTorch, Real-ESRGAN, OpenCV, NumPy (~30 MB)
315+
- ✅ FFmpeg libraries (~25 MB)
316+
317+
**Total Size:** ~800 MB - 1.2 GB (fully standalone)
318+
319+
**Advantages:**
320+
- ✅ Fully standalone (no dependencies)
321+
- ✅ Works on any Mac (macOS 11+)
322+
- ✅ No environment variables needed
323+
- ✅ Ready for distribution (zip/DMG)
324+
325+
### Library Bundling (macOS Release Mode)
326+
327+
**Important:** All library bundling (Qt, FFmpeg, BMF) is handled by **`tool/fix_macos_libs.sh`**, NOT by CMake.
328+
329+
#### **Workflow**
330+
331+
1. **Build**: `cmake -B build-release -DCMAKE_BUILD_TYPE=Release && cd build-release && make -j4`
332+
2. **Bundle**: `cd .. && tool/fix_macos_libs.sh`
333+
334+
The script auto-detects build directory, bundles Qt/FFmpeg/BMF libraries, fixes paths, and code signs.
335+
336+
#### **BMF Library Structure**
337+
338+
```
339+
OpenConverter.app/Contents/
340+
├── Frameworks/
341+
│ ├── lib/ # Builtin modules (BMF hardcoded path)
342+
│ │ ├── libbuiltin_modules.dylib
343+
│ │ ├── libcopy_module.dylib
344+
│ │ └── libcvtcolor.dylib
345+
│ ├── libbmf_module_sdk.dylib # Core BMF libraries
346+
│ ├── libhmp.dylib
347+
│ ├── _bmf.cpython-39-darwin.so
348+
│ └── BUILTIN_CONFIG.json
349+
└── Resources/bmf_python/ # BMF Python package
350+
```
351+
352+
**Why `Frameworks/lib/`?** BMF expects builtin modules in `lib/` subdirectory relative to `BMF_MODULE_CONFIG_PATH`.
353+
354+
**Script Logic:**
355+
- Auto-appends `/output/bmf` to `$BMF_ROOT_PATH` if needed (same as CMake)
356+
- Copies builtin modules to `Frameworks/lib/`
357+
- Copies core libraries to `Frameworks/`
358+
- Processes both `.dylib` and `.so` files
359+
- Fixes all paths to use `@executable_path`
360+
272361
### Translation Workflow
273362

274363
OpenConverter uses Qt Linguist tools for internationalization (i18n). Translation files are located in `src/resources/`.

0 commit comments

Comments
 (0)