Skip to content

Commit fccfbb0

Browse files
authored
Merge pull request #262 from jemygraw/master
rename test files
2 parents 90fda97 + dce0bd7 commit fccfbb0

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

examples/pfop_vframe.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -*- coding: utf-8 -*-
2+
# flake8: noqa
3+
from qiniu import Auth, PersistentFop, build_op, op_save, urlsafe_base64_encode
4+
5+
#对已经上传到七牛的视频发起异步转码操作
6+
access_key = 'Access_Key'
7+
secret_key = 'Secret_Key'
8+
q = Auth(access_key, secret_key)
9+
10+
#要转码的文件所在的空间和文件名。
11+
bucket = 'Bucket_Name'
12+
key = '1.mp4'
13+
14+
#转码是使用的队列名称。
15+
pipeline = 'mpsdemo'
16+
17+
#要进行视频截图操作。
18+
fops = 'vframe/jpg/offset/1/w/480/h/360/rotate/90'
19+
20+
#可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间
21+
saveas_key = urlsafe_base64_encode('目标Bucket_Name:自定义文件key')
22+
fops = fops+'|saveas/'+saveas_key
23+
24+
pfop = PersistentFop(q, bucket, pipeline)
25+
ops = []
26+
ops.append(fops)
27+
ret, info = pfop.execute(key, ops, 1)
28+
print(info)
29+
assert ret['persistentId'] is not None

examples/pfop_watermark.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# -*- coding: utf-8 -*-
2+
# flake8: noqa
3+
from qiniu import Auth, PersistentFop, build_op, op_save, urlsafe_base64_encode
4+
5+
#对已经上传到七牛的视频发起异步转码操作
6+
access_key = 'Access_Key'
7+
secret_key = 'Secret_Key'
8+
q = Auth(access_key, secret_key)
9+
10+
#要转码的文件所在的空间和文件名。
11+
bucket = 'Bucket_Name'
12+
key = '1.mp4'
13+
14+
#转码是使用的队列名称。
15+
pipeline = 'mpsdemo'
16+
17+
#需要添加水印的图片UrlSafeBase64,可以参考http://developer.qiniu.com/code/v6/api/dora-api/av/video-watermark.html
18+
base64URL = urlsafe_base64_encode('http://developer.qiniu.com/resource/logo-2.jpg');
19+
20+
#视频水印参数
21+
fops = 'avthumb/mp4/'+base64URL
22+
23+
#可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间
24+
saveas_key = urlsafe_base64_encode('目标Bucket_Name:自定义文件key')
25+
fops = fops+'|saveas/'+saveas_key
26+
27+
pfop = PersistentFop(q, bucket, pipeline)
28+
ops = []
29+
ops.append(fops)
30+
ret, info = pfop.execute(key, ops, 1)
31+
print(info)
32+
assert ret['persistentId']

0 commit comments

Comments
 (0)