| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 | #!/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 timefrom var_dump import var_dumpimport urllib###########host = "oss-cn-shenzhen.aliyuncs.com"  # just for example# host = "hlsvoda.zositech.cn"  # just for exampleaccessid = '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/1543902118/1543902118.m3u8', 60 * 60, params={'x-oss-process': 'hls/sign'})# 缩略图url = bucket.sign_url('GET', 'FTSLL8HM437Z38WU111A/vod4/2018121001/1543902118/ts0.ts', 60 * 60, params={'x-oss-process': 'video/snapshot,t_10000,m_fast,w_300'})# url = bucket.sign_url('GET', 'FTSLL8HM437Z38WU111A/vod4/2018121001/1543902118/1543902118.m3u8', 60 * 60, params={'x-oss-process': 'hls/sign'})# url = urllib.parse.unquote(url, encoding='utf-8', errors='replace')urllst = url.split('?')url_start = urllib.parse.unquote(urllst[0])url_end = urllst[1]vod_play_url = '{url_start}?{url_end}'.format(url_start=url_start, url_end=url_end)print(vod_play_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_urlsigned_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'''
 |