VLC module in Python – An Introduction
The VLC media player is a free and open-source portable cross-platform media player software and streaming media server developed by the VideoLAN project. VLC is available for desktop operating systems and mobile platforms, such as Android, iOS, iPadOS, Tizen, Windows 10 Mobile, and Windows Phone.
We can use the VLC media player with the help of python as well, in order to install vlc module in python we will use the command given below
pip install python-vlc
Note: In order to use the vlc module in python, the user system should have vlc media player already installed on the machine.
Importing the VLC Module:
To import the VLC module use the following
Fixing error that may occur while importing vlc module
1. If path is not added, the problem is that libvlc.dll is not in the PATH(System Variable). Just add the file libvlc.dll path to system variable, this file can be found in the vlc folder where it is installed
2. Wrong version of VLC, oftenly people download 32bits vlc’s version. This may cause some trouble if we have installed the 64 bits version of python. To fix that, we just need to reinstall the 64 bits vlc’s version.
3. Import os module prior to vlc module and register libvlc.dll using os.add_dll_directory(r’C:\Program Files\VideoLAN\VLC’).
Example 1: Playing Video using VLC
Example 2: Here we will derive the duration of a video file using the VLC module.
"Duration : "
Duration : 5006