Code Monkey home page Code Monkey logo

pyqt-vlc's Introduction

pyqt-vlc

这是一个使用python-vlc实现的视频播放客户端,界面使用pyqt5开发的,有本地和视频流url两种方式,可以实现对阿里云直播服务的实时监测。

界面如下:

image-20210311180730469

image-20210311194145796

前提条件

已安装python3

使用步骤

  1. 安装必要的支持
  • 安装pyqt
sudo pip install pyqt
  • 安装阿里云核心SDK和阿里云直播SDK
sudo pip install aliyun-python-sdk-core
sudo pip install aliyun-python-sdk-live
  • 安装针对于Qt的CSS美化工具
sudo pip install qdarkstyle 
  • 安装python调用vlc的支持库
sudo pip install python-vlc
  1. 将仓库clone到本地
git clone https://github.com/GuotongWu/pyqt-vlc
  1. 安装VLC

下载VLC源码,在工程文件中新建vlc-3.0.11文件夹

mkdir vlc-3.0.11

把下载的压缩包中的libvlc.dll、libvlccore.dll及plugins目录都放到到vlc-3.0.11文件夹里面

cp libvlc.dll libvlccore.dll plugins vlc-3.0.11
  1. 运行Main.py
python pyqt/Main.py

注意

  1. 此播放器针对于阿里云SDK,需要结合自己的AccessKey进行使用,即将下面源码中的XXXXXX修改为自己的账号和密码即可。
# aliyun_copy.py
class Aliyun:
    def __init__(self):
        AK = 'xxxxxxxxxxxxxxxxxxxxxxxx'
        Secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
        self.clt = client.AcsClient(AK, Secret, 'cn-shenzhen')
  1. 播放前需要在适当的位置填写域名,streamName和appName,详情参见阿里云直播文档
# aliyun_copy.py
def describeLiveStreamBitRateDataRequest(self):
    request = DescribeLiveStreamBitRateDataRequest.DescribeLiveStreamBitRateDataRequest()
    request.set_AppName('填写appName')
    request.set_StreamName('填写streamName')
    request.set_DomainName('填写域名')
    request.set_StartTime('2021-02-08T00:28:00Z')
    request.set_EndTime('2021-02-09T10:29:00Z')
    result = self.clt.do_action_with_exception(request)
    x = json.loads(result)
    with open('aliyun.json', 'w') as f:
        json.dump(x, f, indent=1)

pyqt-vlc's People

Contributors

guotongwu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.