{"id":10170,"library":"python-vlc","title":"Python-VLC Bindings","description":"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.","status":"active","version":"3.0.21203","language":"en","source_language":"en","source_url":"https://github.com/oaubert/python-vlc","tags":["multimedia","video","audio","vlc","bindings","player"],"install":[{"cmd":"pip install python-vlc","lang":"bash","label":"Install python-vlc"}],"dependencies":[],"imports":[{"symbol":"vlc","correct":"import vlc"}],"quickstart":{"code":"import vlc\nimport time\nimport os\n\n# NOTE: You MUST have VLC media player installed on your system.\n# For Windows: ensure VLC is installed and its directory (e.g., C:\\Program Files\\VideoLAN\\VLC) is in your PATH.\n# For Linux/macOS: VLC libraries are usually found automatically if installed via package manager.\n\n# Create a VLC instance\ninstance = vlc.Instance(['--no-xlib'])\n\n# Create a media player\nplayer = instance.media_player_new()\n\n# Path to a dummy video file for demonstration.\n# Replace 'path/to/your/video.mp4' with an actual video file on your system.\n# For testing, you can download a sample video or create a dummy file.\n# Example: 'file:///home/user/Videos/test.mp4' or 'C:\\Users\\User\\Videos\\test.mp4'\nmedia_file = os.environ.get('VLC_TEST_MEDIA_PATH', 'file:///path/to/your/video.mp4')\n\n# Create a media object from the file\nmedia = instance.media_new(media_file)\n\n# Set the media to the player\nplayer.set_media(media)\n\n# Play the media\nprint(f\"Attempting to play: {media_file}\")\nplayer.play()\n\n# Wait for a few seconds to allow playback (adjust as needed)\ntime.sleep(5) \n\n# Stop the player\nplayer.stop()\nprint(\"Playback stopped.\")\n","lang":"python","description":"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."},"warnings":[{"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).","message":"python-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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Manually add VLC installation directory to PATH (Windows) or verify VLC installation via package manager (Linux/macOS).","message":"VLC 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.","severity":"gotcha","affected_versions":"All 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.","message":"Compatibility 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).","severity":"breaking","affected_versions":"< 3.0.x system VLC player or future major versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"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.","cause":"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.","error":"OSError: [Errno 0] Error loading libvlc.dll"},{"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.","cause":"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.","error":"OSError: libvlc.so.X not found"},{"fix":"Add `import vlc` at the beginning of your Python script or interactive session.","cause":"The 'vlc' module has not been imported before being used.","error":"NameError: name 'vlc' is not defined"}]}