Skip to content

Commit 811465c

Browse files
feat: add Dev Container support for standardized development environment (#1196)
* chore: add MLT 7 dev Dockerfile with Ubuntu 24.04 support - Includes full multimedia stack, Qt6, and GPU headers - Implements robust UID/GID 1000 conflict resolution - Sets SDL_AUDIODRIVER=dummy for headless compatibility * chore: add devcontainer.json for cross-IDE compatibility - Configures DRI hardware device mapping - Adds privileged/ipc=host placeholders for hardware access - Sets up standard C++ extensions and CMake integration * docs: unify official README with comprehensive Dev Container guide - Adds modern CMake build instructions using a build directory - Details hardware acceleration and audio setup (privileged mode) - Clarifies testing procedures with setenv
1 parent c5534c8 commit 811465c

3 files changed

Lines changed: 225 additions & 25 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
FROM ubuntu:24.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
ENV LANG=C.UTF-8
5+
ENV LC_ALL=C.UTF-8
6+
7+
# 1. System Tools, Compilation, and High-Performance Linker (mold)
8+
RUN apt-get update -qq && apt-get install -yqq \
9+
apt-utils git wget sudo curl build-essential cmake ninja-build \
10+
pkg-config gdb clang-format swig meson yasm nasm \
11+
valgrind kcachegrind \
12+
automake autoconf libtool intltool xutils-dev mold \
13+
python3-dev python3-pip python3-setuptools \
14+
# 2. Multimedia Core (AV1, HDR, SRT, RIST)
15+
libavformat-dev libavcodec-dev libavdevice-dev libavfilter-dev \
16+
libswscale-dev libswresample-dev libpostproc-dev \
17+
libaom-dev libdav1d-dev libsvtav1-dev libvpx-dev \
18+
libx264-dev libx265-dev libsrt-openssl-dev librist-dev \
19+
libsamplerate0-dev libxml2-dev libarchive-dev libexif-dev \
20+
libfftw3-dev libeigen3-dev libebur128-dev libbs2b-dev \
21+
# 3. GPU & Visual (Movit, Vulkan, OpenCV, Vid.Stab, Frei0r)
22+
libgl1-mesa-dev libegl1-mesa-dev libvulkan-dev vulkan-tools \
23+
libmovit-dev libopencv-dev libgavl-dev libvidstab-dev \
24+
libgdk-pixbuf-2.0-dev frei0r-plugins-dev \
25+
# 4. Modern Qt6 Stack (Essential for MLT 7+)
26+
qt6-base-dev qt6-5compat-dev qt6-svg-dev qt6-multimedia-dev \
27+
qt6-shadertools-dev qt6-declarative-dev qt6-l10n-tools \
28+
libqt6core6 libqt6gui6 libqt6widgets6 libqt6opengl6-dev \
29+
# 5. Audio Stack (PipeWire, SPA, Jack, Rubberband)
30+
libpipewire-0.3-dev libspa-0.2-dev libjack-jackd2-dev \
31+
libsox-dev libsdl2-dev libtheora-dev libvorbis-dev libopus-dev \
32+
libflac-dev librubberband-dev ladspa-sdk swh-plugins \
33+
tap-plugins cmt blepvco liblo-dev \
34+
# 6. Vector Graphics and Headless Runtime
35+
libarchive-dev libjsoncpp-dev xvfb libxkbcommon-x11-0 \
36+
fonts-liberation fonts-noto-core libfontconfig1-dev \
37+
libfribidi-dev libharfbuzz-dev \
38+
# 7. Cleanup
39+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
40+
41+
# User Configuration and Hardware Groups
42+
ARG USERNAME=vscode
43+
ARG USER_UID=1000
44+
ARG USER_GID=$USER_UID
45+
46+
RUN if getent group $USER_GID; then \
47+
groupmod -n $USERNAME $(getent group $USER_GID | cut -d: -f1); \
48+
else \
49+
groupadd --gid $USER_GID $USERNAME; \
50+
fi \
51+
&& if getent passwd $USER_UID; then \
52+
usermod -l $USERNAME -m -d /home/$USERNAME $(getent passwd $USER_UID | cut -d: -f1); \
53+
else \
54+
useradd --uid $USER_UID --gid $USER_GID -m $USERNAME; \
55+
fi \
56+
&& usermod -aG sudo $USERNAME \
57+
&& groupadd -f video && usermod -aG video $USERNAME \
58+
&& groupadd -f render && usermod -aG render $USERNAME \
59+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
60+
&& chmod 0440 /etc/sudoers.d/$USERNAME
61+
62+
# Environment Variables
63+
ENV PATH="/usr/lib/qt6/bin:${PATH}"
64+
ENV MLT_REPOSITORY=/usr/local/lib/mlt-7
65+
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
66+
# dummy driver avoids errors in headless environments or CI
67+
ENV SDL_AUDIODRIVER=dummy
68+
69+
USER $USERNAME
70+
WORKDIR /workspaces

.devcontainer/devcontainer.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "MLT Framework Dev 2026",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
"USERNAME": "vscode"
7+
}
8+
},
9+
"runArgs": [
10+
"--device=/dev/dri:/dev/dri",
11+
"--group-add=video",
12+
"--group-add=render"
13+
// For audio and full hardware permissions, uncomment:
14+
// "--ipc=host",
15+
// "--privileged"
16+
],
17+
"remoteUser": "vscode",
18+
"customizations": {
19+
"vscode": {
20+
"settings": {
21+
"terminal.integrated.defaultProfile.linux": "bash",
22+
"cmake.configureOnOpen": true,
23+
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
24+
"editor.formatOnSave": true,
25+
"cmake.buildDirectory": "${workspaceFolder}/build",
26+
"C_Cpp.clang_format_fallbackStyle": "Google"
27+
},
28+
"extensions": [
29+
"ms-vscode.cpptools",
30+
"ms-vscode.cmake-tools",
31+
"twxs.cmake",
32+
"xaver.clang-format",
33+
"ms-vscode.cpptools-extension-pack"
34+
]
35+
}
36+
},
37+
"postCreateCommand": "sudo chmod 666 /dev/dri/render* || true"
38+
}

README.md

Lines changed: 117 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
MLT FRAMEWORK README
2-
--------------------
1+
# MLT FRAMEWORK
32

43
MLT is a LGPL multimedia framework designed for video editing.
54

@@ -11,47 +10,140 @@ See the `docs/` directory for usage details.
1110
See the [website](https://www.mltframework.org/docs/) for development details
1211
and a [contributing](https://www.mltframework.org/docs/contributing/) guide.
1312

13+
---
1414

15-
Configuration
16-
-------------
15+
## Development Environment (Dev Container)
1716

18-
Configuration is triggered by running:
17+
This repository provides a standardized development environment using the [Development Containers](https://containers.dev/) specification. It is compatible with **VS Code**, **CLion**, **DevPod**, and other IDEs supporting the `.devcontainer` standard.
1918

20-
cmake .
19+
### Prerequisites
20+
- Docker (or Podman)
21+
- An IDE with Dev Container support.
2122

22-
More information on usage is found by viewing `CMakeLists.txt` and the [cmake man page](https://cmake.org/cmake/help/latest/manual/cmake.1.html).
23+
### Hardware Acceleration and Audio Support
24+
By default, the container runs in **Restricted Mode** (secure/headless). In this mode:
25+
* Audio is routed to a `dummy` driver (no sound).
26+
* GPU access might be limited to software rendering.
2327

24-
Compilation
25-
-----------
28+
#### Enabling Real Hardware Access
29+
To enable **Full GPU Acceleration (DRI)** and **Physical Audio (ALSA/PulseAudio/PipeWire)**, follow these steps:
30+
31+
1. **Modify `devcontainer.json`**: Uncomment the following lines inside the `runArgs` array:
32+
```json
33+
"--ipc=host",
34+
"--privileged"
35+
```
36+
* **What this does**: `--ipc=host` allows shared memory access for high-performance video frames, and `--privileged` grants the container direct access to host devices (GPU nodes and Sound Cards).
37+
38+
2. **Trigger a Rebuild**: Changes to `runArgs` require a container recreation.
39+
* In VS Code: Run the command `Dev Containers: Rebuild Container`.
40+
* In CLion: Select `Restart and Rebuild Container`.
41+
42+
3. **Switch the Audio Driver**: The `Dockerfile` defaults to `SDL_AUDIODRIVER=dummy`. Once in privileged mode, you must tell the MLT consumer to use a real driver:
43+
* **Temporary (CLI)**:
44+
```bash
45+
SDL_AUDIODRIVER=alsa melt video.mp4
46+
```
47+
* **Permanent**: Edit the `ENV SDL_AUDIODRIVER` line in your `.devcontainer/Dockerfile` to `alsa` or `pulseaudio`.
48+
49+
> **Warning**: Using `--privileged` mode reduces the security isolation between the container and your host machine. Use it only when real-time hardware playback is required for development.
50+
51+
---
52+
## Configuration
53+
54+
Configuration is triggered by running CMake **from inside a build directory**, not from the project root.
55+
56+
```bash
57+
mkdir -p build
58+
cd build
59+
cmake ..
60+
```
61+
62+
Alternatively, you can configure CMake with Ninja:
63+
64+
```bash
65+
cmake -G Ninja ..
66+
```
67+
68+
More information on usage is found by viewing `CMakeLists.txt` and the CMake manual page.
69+
70+
---
71+
72+
## Compilation
2673

2774
Once configured, it should be sufficient to run:
2875

29-
cmake --build .
76+
```bash
77+
cmake --build .
78+
```
79+
80+
Alternatively, you can compile with Ninja:
81+
82+
```bash
83+
ninja
84+
```
85+
86+
Alternatively, you can compile using CMake or Ninja with one less CPU core (recommended only on systems with many CPU cores):
87+
88+
89+
```bash
90+
cmake --build . --parallel $(($(nproc) - 1))
91+
# or
92+
ninja -j $(($(nproc) - 1))
93+
```
94+
95+
All generated files (Makefiles, Ninja files, cache, object files, binaries) will remain inside the `build/` directory.
96+
97+
---
98+
99+
## Testing
100+
101+
To execute the MLT tools without installation, or to test a new version on a system with an already installed MLT version, run:
102+
103+
```bash
104+
source ../setenv
105+
```
106+
107+
NB:
108+
109+
* This applies to the **current shell only**
110+
* It assumes a **bash or Bourne-compatible shell** is in use
111+
* The command must be executed from inside the `build/` directory
112+
113+
---
30114

31-
to compile the system. Alternatively, you can run `cmake` with `-G Ninja` and use ninja to compile.
115+
## Installation
32116

117+
Installation is triggered by running:
33118

34-
Testing
35-
-------
119+
```bash
120+
sudo cmake --install .
121+
```
36122

37-
To execute the mlt tools without installation, or to test a new version
38-
on a system with an already installed mlt version, you should run:
123+
This installs the files generated in the `build/` directory, without affecting the project source tree.
39124

40-
source setenv
125+
> **Note**: After installation, some Linux systems may require running `sudo ldconfig`
126+
> to refresh the shared library cache, especially if the install prefix is not already
127+
> part of the system linker configuration.
41128
42-
NB: This applies to your current shell only and it assumes a bash or
43-
regular bourne shell is in use.
44129

130+
---
45131

46-
Installation
47-
------------
132+
## Summary
48133

49-
The install is triggered by running:
134+
```bash
135+
mkdir build
136+
cd build
137+
cmake ..
138+
cmake --build .
139+
source ../setenv
140+
sudo cmake --install .
141+
```
50142

51-
cmake --install .
143+
This approach keeps the source tree clean and allows the entire build to be removed safely by deleting the `build/` directory.
52144

145+
---
53146

54-
More Information
55-
----------------
147+
# More Information
56148

57-
For more detailed information, please refer to https://mltframework.org/docs/install/.
149+
For more detailed information, please refer to https://mltframework.org/docs/install/.

0 commit comments

Comments
 (0)