Windows下Python加载VLC的方法

參考:https://blog.csdn.net/fleaxin/article/details/101943941

小結:

1. 使用pip install python-vlc, 記住vlc的版本,為下一步下載vlc的lib做準備;

2. 從http://download.videolan.org/pub/videolan/vlc/下載對應的文件,版本和第一步使用pip install的相同;

Sample code如下

import os
import vlc
import time


def get_player(url='rtsp://10.0.0.2/stream1'):
Instance = vlc.Instance()
player = Instance.media_player_new()
Media = Instance.media_new(url)
Media.get_mrl()
player.set_media(Media)
player.play()
return player

if __name__ == '__main__':
player = get_player()
time.sleep(2)
if player.is_playing():
time.sleep(10)
player.release()
player.release()
————————————————
版权声明:本文为CSDN博主「jgw2008」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/jgw2008/article/details/107037329

posted @ 2022-06-13 14:59  苍月代表我  阅读(349)  评论(0)    收藏  举报