使用Python VLC中的按钮开始和停止录制实时流

时间:2018-09-06 09:58:59

标签: python python-3.x vlc libvlc

我有一个脚本,可以使用VLC库从python中的RTSP协议播放实时流。

我希望按钮在单击按钮时开始记录流。从文档中,我了解到保存流的唯一方法是使用

--sout file/muxer:stream.xyz

文档说,在启动这样的vlc实例时,我需要使用sout。

i = vlc.Instance(url_to_video_feed, "--sout=file/ps:output.mpg")

这意味着整个流式视频提要将保存在output.mpg文件中。我只希望保存视频供稿的某些部分。

下面是脚本如何流式传输视频的片段

    self.Instance = vlc.Instance()
    self.player = self.Instance .media_player_new()


    media = self.Instance .media_new(url_to_video_feed,':network-caching=300', )
    self.player.set_media(media)
    self.player.play() # hit the player button

0 个答案:

没有答案