Difference between revisions of "Python bindings"

From VideoLAN Wiki
Jump to navigation Jump to search
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
= Python bindings =
+
== Python bindings ==
 +
The bindings feature:
  
You can find two versions of python bindings: a up-to-date one, which is ctypes-based and is automatically generated.
+
* Complete coverage of the libvlc API, since it is automatically generated from the include files.
You can also find an old one (see [[Old Python bindings]]), hand-written C-module, and deprecated. It will be removed in some future version.
+
* No compilation hassles: the generated module is pure python.
 +
* [https://www.olivieraubert.net/vlc/python-ctypes/doc/ API documentation].
  
== Features ==
+
=== Download ===
 +
The preferred install method is through PyPI:
  
The new module features :
+
pip install python-vlc
* a complete cover of the libvlc API, since it is automatically generated from the include files.
 
* no compilation hassle: the generated module is pure python.
 
* no versioning hassle: the same module works with multiple VLC versions.
 
* a [http://www.advene.org/download/python-ctypes/doc/ complete documentation].
 
  
== Download ==
+
or (if you are using python3):
  
You can download the [http://git.videolan.org/?p=vlc/bindings/python.git;a=tree;f=generated;b=HEAD vlc.py] module from the Git repository. It only depends on ctypes (standard module in python >= 2.5). Put the module in some place accessible by python (either next to your application, or in a directory from sys.path).
+
pip3 install python-vlc
  
Alternatively, you can generate it by yourself using the generate.py program and accompanying files in the vlc source tree (see [http://git.videolan.org/?p=vlc/bindings/python.git;a=tree]).
+
You can also download the [https://git.videolan.org/?p=vlc/bindings/python.git;a=tree;f=generated;b=HEAD vlc.py] module from the Git repository. It only depends on ctypes (standard module in python >= 2.5). Put the module in some place accessible by python (either next to your application, or in a directory from sys.path).
  
== Usage ==
+
Alternatively, you can generate it by yourself using the generate.py program and accompanying files in the vlc source tree (see [https://git.videolan.org/?p=vlc/bindings/python.git;a=tree]).
  
The vlc.py file also contains a runnable example player application (see code at the end of the file, starting from the line "if __name__ == '__main__').  
+
Note that this only installs the python module itself, which depends on the availability of the libvlc libraries. You must also install VLC itself to get these libraries.
  
A set of helper examples [http://git.videolan.org/?p=vlc/bindings/python.git;a=tree;f=examples;hb=HEAD examples] provide a pyGtk, a pyQt and a pyWx player to ease integration.
+
=== Usage ===
 +
The vlc.py file also contains a runnable example player application (see code at the end of the file, starting from the line <code>if __name__ == '__main__'</code>).
  
There is also a [http://git.videolan.org/?p=vlc/bindings/python.git;a=blob;f=README README]
+
A set of helper examples [https://git.videolan.org/?p=vlc/bindings/python.git;a=tree;f=examples;hb=HEAD examples] provide a pyGtk, a pyQt and a pyWx player to ease integration.
  
== Projects using this binding ==
+
There is also a [https://git.videolan.org/?p=vlc/bindings/python.git;a=blob_plain;f=README.rst README]
  
http://code.google.com/p/movie-content-editor/ See also [[LibVLC_Users]]
+
Note: you must install VLC before using it through Python.
  
== FAQ ==
+
=== Projects using this binding ===
 +
https://code.google.com/p/movie-content-editor/ See also [[LibVLC_Users]]
  
===  Win32 initialization ===  
+
=== FAQ ===
 +
====  Win32 initialization ====
 +
When initializing <code>vlc.Instance()</code> with no parameter, it tries to guess the location of the modules. However, if you pass any argument to <code>vlc.Instance()</code>, you will need to supply the appropriate <kbd>--plugin-path=/path/to/the/modules</kbd> yourself.
  
If the vlc modules are not installed in their standard location (e.g. c:\\Program Files\\Videolan on Windows, or /usr/lib/vlc on linux), the VLC module cannot find them.  Add the location of libvlc.dll to your PATH first.
+
==See also==
 +
* [[Old Python bindings]] - The old, obsolete python bindings that are no longer used and since then removed. Kept only for historical interest.
  
When instanciating vlc.Instance() with no parameter, it tries to guess the location of the modules. However, if you pass any argument to vlc.Instance(), you will need to supply the appropriate "--plugin-path=/path/to/the/modules" yourself.
+
[[Category:Bindings]]

Latest revision as of 06:41, 28 June 2019

Python bindings

The bindings feature:

  • Complete coverage of the libvlc API, since it is automatically generated from the include files.
  • No compilation hassles: the generated module is pure python.
  • API documentation.

Download

The preferred install method is through PyPI:

pip install python-vlc

or (if you are using python3):

pip3 install python-vlc

You can also download the vlc.py module from the Git repository. It only depends on ctypes (standard module in python >= 2.5). Put the module in some place accessible by python (either next to your application, or in a directory from sys.path).

Alternatively, you can generate it by yourself using the generate.py program and accompanying files in the vlc source tree (see [1]).

Note that this only installs the python module itself, which depends on the availability of the libvlc libraries. You must also install VLC itself to get these libraries.

Usage

The vlc.py file also contains a runnable example player application (see code at the end of the file, starting from the line if __name__ == '__main__').

A set of helper examples examples provide a pyGtk, a pyQt and a pyWx player to ease integration.

There is also a README

Note: you must install VLC before using it through Python.

Projects using this binding

https://code.google.com/p/movie-content-editor/ See also LibVLC_Users

FAQ

Win32 initialization

When initializing vlc.Instance() with no parameter, it tries to guess the location of the modules. However, if you pass any argument to vlc.Instance(), you will need to supply the appropriate --plugin-path=/path/to/the/modules yourself.

See also

  • Old Python bindings - The old, obsolete python bindings that are no longer used and since then removed. Kept only for historical interest.