File tree Expand file tree Collapse file tree 2 files changed +87
-0
lines changed
Expand file tree Collapse file tree 2 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ require_once __DIR__ . '/../autoload.php ' ;
3+
4+ use Qiniu \Auth ;
5+ use Qiniu \Processing \PersistentFop ;
6+
7+ //对已经上传到七牛的视频发起异步转码操作
8+
9+ $ accessKey = 'Access_Key ' ;
10+ $ secretKey = 'Secret_Key ' ;
11+ $ auth = new Auth ($ accessKey , $ secretKey );
12+
13+ //要转码的文件所在的空间和文件名。
14+ $ bucket = 'Bucket_Name ' ;
15+ $ key = 'File_Name_On_Qiniu ' ;
16+
17+ //转码是使用的队列名称。 https://portal.qiniu.com/mps/pipeline
18+ $ pipeline = 'pipeline_name ' ;
19+
20+ //转码完成后通知到你的业务服务器。
21+ $ notifyUrl = 'http://375dec79.ngrok.com/notify.php ' ;
22+ $ pfop = new PersistentFop ($ auth , $ bucket , $ pipeline , $ notifyUrl );
23+
24+ //要进行视频截图操作
25+ $ fops = "vframe/jpg/offset/1/w/480/h/360/rotate/90 " ;
26+
27+ list ($ id , $ err ) = $ pfop ->execute ($ key , $ fops );
28+ echo "\n====> pfop avthumb result: \n" ;
29+ if ($ err != null ) {
30+ var_dump ($ err );
31+ } else {
32+ echo "PersistentFop Id: $ id \n" ;
33+ }
34+
35+ //查询转码的进度和状态
36+ list ($ ret , $ err ) = $ pfop ->status ($ id );
37+ echo "\n====> pfop avthumb status: \n" ;
38+ if ($ err != null ) {
39+ var_dump ($ err );
40+ } else {
41+ var_dump ($ ret );
42+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ require_once __DIR__ . '/../autoload.php ' ;
3+
4+ use Qiniu \Auth ;
5+ use Qiniu \Processing \PersistentFop ;
6+
7+ //对已经上传到七牛的视频发起异步转码操作
8+
9+ $ accessKey = 'Access_Key ' ;
10+ $ secretKey = 'Secret_Key ' ;
11+ $ auth = new Auth ($ accessKey , $ secretKey );
12+
13+ //要转码的文件所在的空间和文件名。
14+ $ bucket = 'Bucket_Name ' ;
15+ $ key = 'File_Name_On_Qiniu ' ;
16+
17+ //转码是使用的队列名称。 https://portal.qiniu.com/mps/pipeline
18+ $ pipeline = 'pipeline_name ' ;
19+
20+ //转码完成后通知到你的业务服务器。
21+ $ notifyUrl = 'http://375dec79.ngrok.com/notify.php ' ;
22+ $ pfop = new PersistentFop ($ auth , $ bucket , $ pipeline , $ notifyUrl );
23+
24+ //需要添加水印的图片UrlSafeBase64,可以参考http://developer.qiniu.com/code/v6/api/dora-api/av/video-watermark.html
25+ $ base64URL = Qiniu \base64_urlSafeEncode ('http://developer.qiniu.com/resource/logo-2.jpg ' );
26+
27+ //水印参数
28+ $ fops = "avthumb/mp4/s/640x360/vb/1.4m/image/ " .$ base64URL ;
29+
30+ list ($ id , $ err ) = $ pfop ->execute ($ key , $ fops );
31+ echo "\n====> pfop avthumb result: \n" ;
32+ if ($ err != null ) {
33+ var_dump ($ err );
34+ } else {
35+ echo "PersistentFop Id: $ id \n" ;
36+ }
37+
38+ //查询转码的进度和状态
39+ list ($ ret , $ err ) = $ pfop ->status ($ id );
40+ echo "\n====> pfop avthumb status: \n" ;
41+ if ($ err != null ) {
42+ var_dump ($ err );
43+ } else {
44+ var_dump ($ ret );
45+ }
You can’t perform that action at this time.
0 commit comments