1
votes

I'm trying to play the video using libvlc with python script, for that i got one script in the stack overflow post.

the script is follows:

 import os
 import sys
 import vlc

  if __name__ == '__main__':
#filepath = <either-some-url-or-local-path>
movie = os.path.expanduser(filepath)
if 'http://' not in filepath:
    if not os.access(movie, os.R_OK):
        print ( 'Error: %s file is not readable' % movie )
        sys.exit(1)
instance = vlc.Instance("--sout=#duplicate{dst=file{dst=example.mpg},dst=display}")
try:
    media = instance.media_new(movie)
except NameError:
    print ('NameError: % (%s vs Libvlc %s)' % (sys.exc_info()[1],
                   vlc.__version__, vlc.libvlc_get_version()))
    sys.exit(1)
player = instance.media_player_new()
player.set_media(media)
player.play()

#dont exit!
while(1):
    continue

when i run this code, i'm getting the eror like:

    Traceback (most recent call last):
    File "test1.py", line 3, in <module>
    import vlc
    ImportError: No module named vlc

How to import the vlc bindings in to the mechine, can any please help me...

1

1 Answers

0
votes

According to Python bindings VLC documentation:

You can 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).