#!/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 = 'LTAIyMkGfEdogyL9' accesskey = '71uIjpsqVOmF7DAITRyRuc259jHOjO' bucket_name = "cloudvod1" channel_name = "vod" auth = Auth(accessid, accesskey) bucket = Bucket(auth, host, bucket_name) ###################### # 生成oss签名url url = bucket.sign_url('GET', 'vod/1543561927/1543561927.m3u8', 60 * 60, params={'x-oss-process': 'hls/sign'}) # url = bucket.sign_url('GET', 'vod/1543561897/1543561897.m3u8', 60 * 60, params={'x-oss-process': 'hls/sign'}) # url = bucket.sign_url('GET', 'vod/1543561865/1543561865.m3u8', 60 * 60, params={'x-oss-process': 'hls/sign'}) # url = urllib.parse.unquote(url, encoding='utf-8', errors='replace') # url=urllib.parse.unquote(url) 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(frag_count=10)) channel = bucket.create_live_channel(channel_name, channel_cfg) publish_url = channel.publish_url signed_publish_url = bucket.sign_rtmp_url("vod", "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