fix: Compile v8.1.1 instead of latest ffmpeg for Ubuntu, remove override for MainWindow::nativeEvent, and change Windows packages to UCRT.

This commit is contained in:
2026-05-21 17:40:24 +08:00
parent 444a8e5287
commit 0984756c19
4 changed files with 289 additions and 62 deletions
+14 -14
View File
@@ -39,7 +39,7 @@ jobs:
- name: Build FFmpeg from source (Linux) - name: Build FFmpeg from source (Linux)
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: | run: |
git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg-src git clone --branch n8.1.1 --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg-src
cd ffmpeg-src cd ffmpeg-src
./configure \ ./configure \
--prefix="$PWD/../ffmpeg-install" \ --prefix="$PWD/../ffmpeg-install" \
@@ -88,21 +88,21 @@ jobs:
if: runner.os == 'Windows' if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2 uses: msys2/setup-msys2@v2
with: with:
msystem: MINGW64 msystem: UCRT64
update: true update: true
install: >- install: >-
mingw-w64-x86_64-cmake mingw-w64-ucrt-x86_64-cmake
mingw-w64-x86_64-ninja mingw-w64-ucrt-x86_64-ninja
mingw-w64-x86_64-gcc mingw-w64-ucrt-x86_64-gcc
mingw-w64-x86_64-qt6-base mingw-w64-ucrt-x86_64-qt6-base
mingw-w64-x86_64-qt6-tools mingw-w64-ucrt-x86_64-qt6-tools
mingw-w64-x86_64-ffmpeg mingw-w64-ucrt-x86_64-ffmpeg
mingw-w64-x86_64-openimageio mingw-w64-ucrt-x86_64-openimageio
mingw-w64-x86_64-opencolorio mingw-w64-ucrt-x86_64-opencolorio
mingw-w64-x86_64-openexr mingw-w64-ucrt-x86_64-openexr
mingw-w64-x86_64-fmt mingw-w64-ucrt-x86_64-fmt
mingw-w64-x86_64-expat mingw-w64-ucrt-x86_64-expat
mingw-w64-x86_64-portaudio mingw-w64-ucrt-x86_64-portaudio
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# Configure # Configure
+1 -1
View File
@@ -110,7 +110,7 @@ protected:
#ifdef Q_OS_WINDOWS #ifdef Q_OS_WINDOWS
virtual bool nativeEvent(const QByteArray &eventType, void *message, virtual bool nativeEvent(const QByteArray &eventType, void *message,
long *result) override; long *result);
#endif #endif
private: private:
+68 -20
View File
@@ -7,7 +7,7 @@ This document describes how to build Oak Video Editor from source on Windows, Li
- CMake 3.20+ - CMake 3.20+
- Ninja (recommended) - Ninja (recommended)
- Qt 6 (with private headers) - Qt 6 (with private headers)
- FFmpeg development libraries - FFmpeg 8.0+ development libraries (distro packages on Ubuntu/Debian are often too old; see the Linux section below)
- OpenImageIO - OpenImageIO
- OpenColorIO (2.x) - OpenColorIO (2.x)
- OpenEXR - OpenEXR
@@ -20,31 +20,32 @@ This document describes how to build Oak Video Editor from source on Windows, Li
## Windows (MSYS2) ## Windows (MSYS2)
This guide uses [MSYS2](https://www.msys2.org/) with the MinGW-w64 toolchain. This guide uses [MSYS2](https://www.msys2.org/) with the UCRT64 toolchain.
### 1. Install MSYS2 ### 1. Install MSYS2
Download and install MSYS2 from [https://www.msys2.org/](https://www.msys2.org/). Then open the **MSYS2 MinGW 64-bit** terminal. Download and install MSYS2 from [https://www.msys2.org/](https://www.msys2.org/). Then open the **MSYS2 UCRT64** terminal.
### 2. Install Dependencies ### 2. Install Dependencies
```bash ```bash
pacman -Syu pacman -Syu
pacman -S --needed \ pacman -S --needed \
mingw-w64-x86_64-cmake \ mingw-w64-ucrt-x86_64-cmake \
mingw-w64-x86_64-ninja \ mingw-w64-ucrt-x86_64-ninja \
mingw-w64-x86_64-qt6-base \ mingw-w64-ucrt-x86_64-qt6-base \
mingw-w64-x86_64-qt6-tools \ mingw-w64-ucrt-x86_64-qt6-tools \
mingw-w64-x86_64-ffmpeg \ mingw-w64-ucrt-x86_64-ffmpeg \
mingw-w64-x86_64-openimageio \ mingw-w64-ucrt-x86_64-openimageio \
mingw-w64-x86_64-opencolorio \ mingw-w64-ucrt-x86_64-opencolorio \
mingw-w64-x86_64-openexr \ mingw-w64-ucrt-x86_64-openexr \
mingw-w64-x86_64-expat \ mingw-w64-ucrt-x86_64-fmt \
mingw-w64-x86_64-portaudio \ mingw-w64-ucrt-x86_64-expat \
mingw-w64-x86_64-gcc mingw-w64-ucrt-x86_64-portaudio \
mingw-w64-ucrt-x86_64-gcc
``` ```
> **Note:** Qt 6 private headers may require additional packages depending on the MSYS2 repository state. If CMake reports missing private headers, install `mingw-w64-x86_64-qt6-base-private` if available. > **Note:** Qt 6 private headers may require additional packages depending on the MSYS2 repository state. If CMake reports missing private headers, install `mingw-w64-ucrt-x86_64-qt6-base-private` if available.
### 3. Clone and Build ### 3. Clone and Build
@@ -74,22 +75,44 @@ ctest --test-dir build --output-on-failure -C Release
### Debian / Ubuntu ### Debian / Ubuntu
Install dependencies: Install dependencies (FFmpeg is built from source below because distro packages are often too old):
```bash ```bash
sudo apt-get update sudo apt-get update
sudo apt-get install -y \ sudo apt-get install -y \
cmake ninja-build pkg-config \ cmake ninja-build pkg-config nasm \
qt6-base-dev qt6-base-dev-tools qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools \ qt6-base-dev qt6-base-dev-tools qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools \
libavcodec-dev libavformat-dev libavfilter-dev libavutil-dev libswscale-dev libswresample-dev \
libopencolorio-dev libopenimageio-dev libopenexr-dev libexpat1-dev \ libopencolorio-dev libopenimageio-dev libopenexr-dev libexpat1-dev \
portaudio19-dev libgl1-mesa-dev libxkbcommon-dev portaudio19-dev libgl1-mesa-dev libxkbcommon-dev
``` ```
Build FFmpeg 8.0+ from source:
```bash
git clone --branch n8.1.1 --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg-src
cd ffmpeg-src
./configure \
--prefix="$PWD/../ffmpeg-install" \
--enable-static \
--disable-shared \
--disable-doc \
--disable-programs \
--disable-avdevice \
--disable-network \
--enable-pic \
--enable-gpl \
--enable-version3
make -j$(nproc)
make install
cd ..
```
Configure and build: Configure and build:
```bash ```bash
cmake -S . -B build -G Ninja -DBUILD_TESTS=ON -DBUILD_QT6=ON cmake -S . -B build -G Ninja \
-DBUILD_TESTS=ON -DBUILD_QT6=ON \
-DFFMPEG_ROOT="$PWD/ffmpeg-install"
cmake --build build --config Release cmake --build build --config Release
``` ```
@@ -239,7 +262,7 @@ export PATH="/path/to/qt6/bin:$PATH"
export CMAKE_PREFIX_PATH="/path/to/qt6" export CMAKE_PREFIX_PATH="/path/to/qt6"
# Windows (MSYS2) # Windows (MSYS2)
export PATH="/mingw64/bin:$PATH" export PATH="/ucrt64/bin:$PATH"
``` ```
### Missing Private Headers ### Missing Private Headers
@@ -253,3 +276,28 @@ Make sure FFmpeg development libraries are installed and `pkg-config` can locate
```bash ```bash
pkg-config --exists libavcodec && echo "Found" || echo "Not found" pkg-config --exists libavcodec && echo "Found" || echo "Not found"
``` ```
### FFmpeg Version Too Old
If you encounter errors like `AV_PIX_FMT_GRAYF16 was not declared in this scope`, your FFmpeg is too old (Oak requires 8.0+). Build from source:
```bash
git clone --branch n8.1.1 --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg-src
cd ffmpeg-src
./configure \
--prefix="$PWD/../ffmpeg-install" \
--enable-static \
--disable-shared \
--disable-doc \
--disable-programs \
--disable-avdevice \
--disable-network \
--enable-pic \
--enable-gpl \
--enable-version3
make -j$(nproc)
make install
cd ..
```
Then pass `-DFFMPEG_ROOT="$PWD/ffmpeg-install"` to CMake.
+206 -27
View File
@@ -1,13 +1,13 @@
# 构建指南 # 构建指南
本文档介绍如何从源码构建 Oak Video Editor。 本文档介绍如何在 Windows、Linux 和 macOS 上从源码构建 Oak Video Editor。
## 依赖 ## 依赖
- CMake 3.20+ - CMake 3.20+
- Ninja(推荐) - Ninja(推荐)
- Qt 6(含私有头文件) - Qt 6(含私有头文件)
- FFmpeg 开发库 - FFmpeg 8.0+ 开发库(Ubuntu/Debian 系统源里的版本通常太旧,见下文 Linux 章节)
- OpenImageIO - OpenImageIO
- OpenColorIO2.x - OpenColorIO2.x
- OpenEXR - OpenEXR
@@ -16,20 +16,131 @@
- OpenGL 头文件 - OpenGL 头文件
- XKB commonLinux - XKB commonLinux
## LinuxUbuntu/Debian ---
安装依赖: ## WindowsMSYS2
本指南使用 [MSYS2](https://www.msys2.org/) 的 UCRT64 工具链。
### 1. 安装 MSYS2
从 [https://www.msys2.org/](https://www.msys2.org/) 下载并安装 MSYS2,然后打开 **MSYS2 UCRT64** 终端。
### 2. 安装依赖
```bash
pacman -Syu
pacman -S --needed \
mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-ninja \
mingw-w64-ucrt-x86_64-qt6-base \
mingw-w64-ucrt-x86_64-qt6-tools \
mingw-w64-ucrt-x86_64-ffmpeg \
mingw-w64-ucrt-x86_64-openimageio \
mingw-w64-ucrt-x86_64-opencolorio \
mingw-w64-ucrt-x86_64-openexr \
mingw-w64-ucrt-x86_64-fmt \
mingw-w64-ucrt-x86_64-expat \
mingw-w64-ucrt-x86_64-portaudio \
mingw-w64-ucrt-x86_64-gcc
```
> **注意:** Qt 6 私有头文件可能需要额外安装。如果 CMake 报告找不到私有头文件,请尝试安装 `mingw-w64-ucrt-x86_64-qt6-base-private`(如果仓库中有)。
### 3. 克隆并构建
```bash
# 克隆仓库
git clone --recursive https://github.com/OakVideoEditorCommunity/oak.git
cd oak
# 配置
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_QT6=ON
# 构建
cmake --build build --config Release
```
### 4. 运行测试(可选)
```bash
ctest --test-dir build --output-on-failure -C Release
```
---
## Linux
### Debian / Ubuntu
安装依赖(FFmpeg 需要自行从源码编译,因为系统源里的版本通常太旧):
```bash ```bash
sudo apt-get update sudo apt-get update
sudo apt-get install -y \ sudo apt-get install -y \
ninja-build pkg-config \ cmake ninja-build pkg-config nasm \
qt6-base-dev qt6-base-dev-tools qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools \ qt6-base-dev qt6-base-dev-tools qt6-base-private-dev qt6-tools-dev qt6-tools-dev-tools \
libavcodec-dev libavformat-dev libavfilter-dev libavutil-dev libswscale-dev libswresample-dev \
libopencolorio-dev libopenimageio-dev libopenexr-dev libexpat1-dev \ libopencolorio-dev libopenimageio-dev libopenexr-dev libexpat1-dev \
portaudio19-dev libgl1-mesa-dev libxkbcommon-dev portaudio19-dev libgl1-mesa-dev libxkbcommon-dev
``` ```
从源码编译 FFmpeg 8.0+
```bash
git clone --branch n8.1.1 --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg-src
cd ffmpeg-src
./configure \
--prefix="$PWD/../ffmpeg-install" \
--enable-static \
--disable-shared \
--disable-doc \
--disable-programs \
--disable-avdevice \
--disable-network \
--enable-pic \
--enable-gpl \
--enable-version3
make -j$(nproc)
make install
cd ..
```
配置并构建:
```bash
cmake -S . -B build -G Ninja \
-DBUILD_TESTS=ON -DBUILD_QT6=ON \
-DFFMPEG_ROOT="$PWD/ffmpeg-install"
cmake --build build --config Release
```
运行测试:
```bash
ctest --test-dir build --output-on-failure -C Release
```
### Fedora
安装依赖:
```bash
sudo dnf install -y \
cmake ninja-build pkgconf-pkg-config \
qt6-qtbase-devel qt6-qtbase-private-devel qt6-qttools-devel \
ffmpeg-devel \
OpenImageIO-devel \
OpenColorIO-devel \
openexr-devel \
expat-devel \
portaudio-devel \
mesa-libGL-devel \
libxkbcommon-devel \
gcc-c++
```
配置并构建: 配置并构建:
```bash ```bash
@@ -43,6 +154,43 @@ cmake --build build --config Release
ctest --test-dir build --output-on-failure -C Release ctest --test-dir build --output-on-failure -C Release
``` ```
### Arch Linux
安装依赖:
```bash
sudo pacman -Syu
sudo pacman -S --needed \
cmake ninja pkgconf \
qt6-base qt6-tools \
ffmpeg \
openimageio \
opencolorio \
openexr \
expat \
portaudio \
mesa \
libxkbcommon \
gcc
```
> **注意:** Arch Linux 的 `qt6-base` 包已经包含私有头文件。
配置并构建:
```bash
cmake -S . -B build -G Ninja -DBUILD_TESTS=ON -DBUILD_QT6=ON
cmake --build build --config Release
```
运行测试:
```bash
ctest --test-dir build --output-on-failure -C Release
```
---
## macOS(非官方支持) ## macOS(非官方支持)
说明:macOS **非官方支持**,目前只做 CI 自动化测试,不做人工测试。 说明:macOS **非官方支持**,目前只做 CI 自动化测试,不做人工测试。
@@ -51,7 +199,7 @@ ctest --test-dir build --output-on-failure -C Release
```bash ```bash
brew update brew update
brew install ninja pkg-config qt@6 ffmpeg openimageio opencolorio openexr portaudio expat brew install cmake ninja pkg-config qt@6 ffmpeg openimageio opencolorio openexr portaudio expat
``` ```
构建 OpenTimelineIO(可选,如需 OTIO 支持): 构建 OpenTimelineIO(可选,如需 OTIO 支持):
@@ -87,30 +235,61 @@ cmake --build build --config Release
ctest --test-dir build --output-on-failure -C Release ctest --test-dir build --output-on-failure -C Release
``` ```
## Windows ---
Qt 6 请使用系统安装器或 CI action。其余依赖建议用 vcpkg。 ## 构建选项
```powershell | 选项 | 默认值 | 说明 |
choco install -y ninja |------|--------|------|
$env:VCPKG_ROOT = "C:\vcpkg" | `BUILD_TESTS` | `OFF` | 构建单元测试 |
& "$env:VCPKG_ROOT\vcpkg.exe" install ffmpeg openimageio opencolorio openexr expat portaudio --triplet x64-windows | `BUILD_DOXYGEN` | `OFF` | 构建 Doxygen 文档 |
| `USE_WERROR` | `OFF` | 将警告视为错误 |
| `BUILD_QT6` | `ON` | 使用 Qt 6 而非 Qt 5 |
| `OTIO_LOCATION` | - | OpenTimelineIO 安装路径(可选) |
| `OCIO_LOCATION` | - | OpenColorIO 安装路径 |
---
## 故障排除
### 找不到 Qt 6
确保 Qt 6 在 PATH 和 CMake prefix path 中:
```bash
# Linux / macOS
export PATH="/path/to/qt6/bin:$PATH"
export CMAKE_PREFIX_PATH="/path/to/qt6"
# WindowsMSYS2
export PATH="/ucrt64/bin:$PATH"
``` ```
配置并构建: ### 缺少私有头文件
```powershell 如果看到缺少 Qt 私有头文件的错误,请安装对应发行版的私有开发包(例如 Debian/Ubuntu 上的 `qt6-base-private-dev`Fedora 上的 `qt6-qtbase-private-devel`)。
cmake -S . -B build -G Ninja `
-DBUILD_TESTS=ON ` ### FFmpeg 版本太旧
-DBUILD_QT6=ON `
-DCMAKE_BUILD_TYPE=Release ` 如果遇到 `AV_PIX_FMT_GRAYF16 was not declared in this scope` 之类的错误,说明你的 FFmpeg 版本太旧(Oak 需要 8.0+)。请从源码编译:
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" `
-DCMAKE_PREFIX_PATH="$env:Qt6_DIR" ```bash
cmake --build build --config Release git clone --branch n8.1.1 --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg-src
cd ffmpeg-src
./configure \
--prefix="$PWD/../ffmpeg-install" \
--enable-static \
--disable-shared \
--disable-doc \
--disable-programs \
--disable-avdevice \
--disable-network \
--enable-pic \
--enable-gpl \
--enable-version3
make -j$(nproc)
make install
cd ..
``` ```
运行测试: 然后在 CMake 中加上 `-DFFMPEG_ROOT="$PWD/ffmpeg-install"`
```powershell
ctest --test-dir build --output-on-failure -C Release
```