← Back

ofxVlc4

github.com/Jonathhhan/ofxVlc4 · @Jonathhhan
OF 0.12 Video/Camera

openFrameworks wrapper around libVLC 4 with texture-based video output, playlist and transport controls.

4 1 Last commit 6mo ago Created 6mo ago

Branches ahead of main

These branches have commits not yet on main — could be unmerged fixes or work in progress worth a look.

claude/add-edit-subtitle-functionality 1 commit ahead · last commit 6mo ago

README

ofxVlc4



ofxVlc4 is an openFrameworks wrapper around libVLC 4 with a texture-based video path, optional native-window backends on Windows, playlist helpers, transport controls, media discovery, diagnostics, recording helpers, MIDI utilities, and a large GUI example.

The main public header is:

Bundled VLC help assets:

It is aimed at media-player style apps, video-texture workflows, and hybrid tools where playback, analysis, overlays, and custom rendering need to live inside openFrameworks.

ofxVlc4Example screenshot

Note



Parts of this addon, its examples, GUI structure, and documentation were developed with AI-assisted help during implementation and refinement.

License



This addon is released under the MIT License.

Release



Highlights



Source layout



The main public API stays in:

Implementation is split by concern:

Support classes:

Clone / install quick start



Clone the addon into your openFrameworks addons folder:

git clone https://github.com/Jonathhhan/ofxVlc4.git


Then install the bundled libVLC layout:

bash scripts/install-libvlc.sh


On Windows, that script now prepares each example directly for Project Generator users:

The examples do not ship a bundled sample movie in bin/data. Drop your own media into an example's bin/data, drag a file in at runtime, or use the standard openFrameworks sample video from examples/video/videoPlayerExample/bin/data/movies/fingers.mp4.

Installing libVLC



The addon ships with a single cross-platform shell entry point that installs libVLC headers/import libs into libs/libvlc and the shared Windows runtime into runtime/vs/x64.

If you want one shell entry point across supported environments, use:

bash scripts/install-libvlc.sh


The script dispatches to:

Windows



Run:

bash scripts/install-libvlc.sh


This installs:

For the Windows examples, the intended runtime layout in bin includes:

If you ever see all VLC plugin DLLs flattened directly into bin, that is a staging/build-layout problem rather than the intended release layout.

For normal addon development, keep the shared Windows runtime in runtime/vs/x64 and let the examples link to it locally. Only copy the VLC runtime into your app output if you want a truly standalone distribution.

The installer works in a temporary directory outside the addon tree, which is helpful when the addon lives in a synced or otherwise path-sensitive folder.

macOS



Run:

bash scripts/install-libvlc.sh


or point it at a specific app bundle:

bash scripts/install-libvlc.sh --vlc-app /Applications/VLC.app


This installs:

For the staged macOS runtime, the installer also rewrites the copied VLC dylib IDs and dependency paths with install_name_tool, and the addon adds matching @rpath entries for:

At runtime the addon additionally exports VLC_PLUGIN_PATH to data/libvlc/macos/plugins, so both the loader path and plugin discovery path point at the staged example runtime.

The macOS path is meant for the default texture backend. The Windows-only HWND and D3D11 output modes are not used on macOS.

Linux / WSL



Run:

bash scripts/install-libvlc.sh


In WSL or Git Bash on Windows, this wrapper calls the Windows PowerShell installer. On native Linux it exits with a reminder to use system libvlc packages instead.

Native Linux



Install VLC 4 and libVLC development packages through your package manager. On Linux the addon links through pkg-config.

Example dependencies



The full example also depends on:

Example:

git clone --branch develop https://github.com/jvcleave/ofxImGui.git


Examples



For audio-visualization workflows, the addon treats ofxProjectM as the primary integrated path. Bundled VLC visualization plugins remain available through the staged runtime, but they should currently be treated as experimental libVLC runtime extras rather than as the main addon feature path.

For the examples, also see:

Subsystem quick reference



API Documentation: For comprehensive API organization, usage patterns, and subsystem guides, see docs/API_GUIDE.md. To generate full API reference documentation with Doxygen, run doxygen in the repository root (output: docs/api/html/index.html).

Migration Guide: Transitioning from ofVideoPlayer? See docs/MIGRATION_FROM_OFVIDEOPLAYER.md for a complete migration guide with API mapping and code examples.

Contributing: Interested in contributing? See CONTRIBUTING.md for development workflow, code standards, and testing guidelines.

Simplified APIs: For simpler use cases, check out the facade classes in src/facade/:

Minimal API



For the stable texture-based workflow, the recommended order is:

ofxVlc4 player;

void ofApp::setup() {
    player.setAudioCaptureEnabled(true);   // optional, before init()
    player.init(0, nullptr);
    player.setWatchTimeEnabled(true);      // optional, recommended for UI/transport
    player.setWatchTimeMinPeriodUs(50000); // optional

    player.addPathToPlaylist(ofToDataPath("movie.mp4", true));
    player.playIndex(0);
}

void ofApp::update() {
    player.update();
}

void ofApp::draw() {
    player.draw(0, 0, ofGetWidth(), ofGetHeight());
}

void ofApp::exit() {
    player.close();
}


For advanced libVLC startup overrides, the addon now supports both typed pre-init settings and raw argument escape hatches:

That ordering is intentional: typed settings stay discoverable and documented, while raw args remain available as an advanced override path when you need a libVLC option the addon does not model directly yet.

Useful state getters:

Common controls:

Playlist helpers:

External slave helpers:

Structured playlist API:

Recorder helpers:

Structured recorder API:

Structured MIDI API:

Structured playback clock API:

Useful newer API groups:

Recommended projectM assets



For the ofxProjectM-powered parts of the full example, these packs are recommended:

Download them with:

bash ofxVlc4Example/scripts/download-projectm-assets.sh


Place them like this:

Notes



Backend capability notes



Known limits



Critical paths



Startup State Model



For startup-sensitive apps, the addon now distinguishes a few early playback phases instead of treating them as the same thing:

Get this addon

HTTPS
SSH