Registry / http-networking / python-vlc

python-vlc

JSON →
library3.0.21203pypypi✓ verified 87d ago

Python-VLC provides Python bindings for the VLC media player. It allows developers to integrate VLC's powerful multimedia capabilities, such as playing audio and video, streaming, and capturing, directly into Python applications. The current version, 3.0.21203, is generally kept in sync with major VLC releases, reflecting VLC 3.x features. While releases aren't on a strict cadence, updates typically follow significant VLC player developments.

pip install python-vlc
INSTALL
IMPORT
SIG · PYTHON-VLC
P
python-vlc
http-networkingpythonv3.0.21203
Install
1.6s avg
Import
111ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.21203 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.114s · 18.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.108s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

vlc
import vlc

Demonstrates initializing VLC, loading a media file, and playing it for a short duration. Remember to replace the placeholder media path with an actual file and ensure VLC media player is installed.

import vlc import time import os # NOTE: You MUST have VLC media player installed on your system. # For Windows: ensure VLC is installed and its directory (e.g., C:\Program Files\VideoLAN\VLC) is in your PATH. # For Linux/macOS: VLC libraries are usually found automatically if installed via package manager. # Create a VLC instance instance = vlc.Instance(['--no-xlib']) # Create a media player player = instance.media_player_new() # Path to a dummy video file for demonstration. # Replace 'path/to/your/video.mp4' with an actual video file on your system. # For testing, you can download a sample video or create a dummy file. # Example: 'file:///home/user/Videos/test.mp4' or 'C:\Users\User\Videos\test.mp4' media_file = os.environ.get('VLC_TEST_MEDIA_PATH', 'file:///path/to/your/video.mp4') # Create a media object from the file media = instance.media_new(media_file) # Set the media to the player player.set_media(media) # Play the media print(f"Attempting to play: {media_file}") player.play() # Wait for a few seconds to allow playback (adjust as needed) time.sleep(5) # Stop the player player.stop() print("Playback stopped.")
Debug
Known issues
gotchapython-vlc are bindings, not the player itself. You *must* have VLC media player installed on your system for python-vlc to function. This is often overlooked.
fix
Install VLC media player (e.g., via your OS package manager, official installer, or Homebrew for macOS). Ensure its libraries are discoverable by your system (often via PATH on Windows, or standard library paths on Linux/macOS).
affects: All versions
gotchaVLC library discovery can be platform-specific. On Windows, ensure VLC's installation directory (e.g., `C:\Program Files\VideoLAN\VLC`) is added to your system's PATH environment variable. On Linux/macOS, ensure VLC is installed via a package manager so its shared libraries (`libvlc.so`/`.dylib`) are in standard locations.
fix
Manually add VLC installation directory to PATH (Windows) or verify VLC installation via package manager (Linux/macOS).
affects: All versions
breakingCompatibility issues may arise if your system's installed VLC media player version is significantly older or newer than what the python-vlc bindings expect (typically VLC 3.x for current python-vlc versions).
fix
Ensure your system's VLC media player version is up-to-date and compatible with the python-vlc version you are using. The current python-vlc (3.x) is designed for VLC 3.x.
affects: < 3.0.x system VLC player or future major versions
Errors
Common errors & fixes
OSError: [Errno 0] Error loading libvlc.dll
The VLC media player is either not installed or its dynamic link libraries (libvlc.dll/libvlccore.dll) cannot be found by python-vlc. This often happens on Windows if VLC's installation directory is not in the system PATH.
fix
Install VLC media player from its official website. If already installed, add the VLC installation directory (e.g., `C:\Program Files\VideoLAN\VLC`) to your system's PATH environment variable and restart your terminal/IDE.
OSError: libvlc.so.X not found
Similar to the Windows error, this indicates that the VLC shared libraries (`libvlc.so`, `libvlccore.so`) are not found on Linux systems. This usually means VLC is not installed or not in standard library paths.
fix
Install VLC media player using your distribution's package manager (e.g., `sudo apt install vlc` on Debian/Ubuntu, `sudo dnf install vlc` on Fedora). Ensure `libvlc-dev` or similar development packages are also installed if required for bindings.
NameError: name 'vlc' is not defined
The 'vlc' module has not been imported before being used.
fix
Add `import vlc` at the beginning of your Python script or interactive session.
Upgrade
Version history
3.0.21203latest on PyPI · released Oct 7, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
73 hits · last 30 days
node
70
Resources
python-vlc — pip install python-vlc · libregistry