#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved. @AUTHOR: ASJRD018 @NAME: AnsjerFormal @software: PyCharm @DATE: 2018/9/19 10:53 @Version: python3.6 @MODIFY DECORD:ansjer dev @file: oss.py @Contact: chanjunkai@163.com """ from oss2 import * from oss2.models import * import time from var_dump import var_dump import urllib ########### host = "oss-cn-shenzhen.aliyuncs.com" # just for example accessid = "LTAI5pJxXXklo2ve" accesskey = "ngFu11aTJmA0BoYmt8WT7JyyQ2Wmx1" bucket_name = "testrtmp" channel_name = "test-channel" auth = Auth(accessid, accesskey) bucket = Bucket(auth, host, bucket_name) ###################### # 生成oss签名url url = bucket.sign_url('GET', 'test-channel/test.m3u8', 60 * 60, params={'x-oss-process': 'hls/sign'}) url = urllib.parse.unquote(url, encoding='utf-8', errors='replace') print(url) exit() # 播放m3u8 m3list = bucket.post_vod_playlist(channel_name=channel_name, playlist_name='test.m3u8', start_time=1537336020119, end_time=1537336029318) exit() # 获取推流地址 channel_cfg = LiveChannelInfo(target=LiveChannelInfoTarget()) channel = bucket.create_live_channel(channel_name, channel_cfg) publish_url = channel.publish_url signed_publish_url = bucket.sign_rtmp_url("test-channel", "playlist.m3u8", 3600) print(signed_publish_url) ''' 直播录制转为媒体文件 https://help.aliyun.com/document_detail/64997.html?spm=a2c4g.11186623.2.11.78274c07rvcHUR ''' from aliyunsdkcore import client # from aliyunsdklive