How does vlc.py play video stream?

后端 未结 3 631
不思量自难忘°
不思量自难忘° 2020-12-14 20:29

I want to use vlc.py to play mpeg2 stream http://wiki.videolan.org/Python_bindings.

There are some examples here: http://git.videolan.org/?p=vlc/bindings/python.git;

3条回答
  •  隐瞒了意图╮
    2020-12-14 20:49

    This is a bare bones solution:

    import vlc
    Instance = vlc.Instance()
    player = Instance.media_player_new()
    Media = Instance.media_new('http://localhost/postcard/GWPE.avi')
    Media.get_mrl()
    player.set_media(Media)
    player.play()
    

    if the media is a local file you will have to alter:

    Media = Instance.media_new('http://localhost/postcard/GWPE.avi')
    Media.get_mrl()
    

    to:

    Media = Instance.media_new_path('/path/to_your/file/filename.avi')
    

    note that you must lose the get_mrl() as well as changing the function.

提交回复
热议问题