日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

水印

更新時(shí)間:

在視頻中添加可見(jiàn)的明水印(例如,企業(yè)Logo、電視臺(tái)臺(tái)標(biāo)),可以突出品牌和版權(quán),增加產(chǎn)品識(shí)別度。媒體處理支持圖片水印動(dòng)畫(huà)水印文字水印三種水印類型,您可以按需選擇。本文介紹PHP SDK使用水印相關(guān)功能的API調(diào)用示例。

完整代碼

<?php
require_once './aliyun-php-sdk-core/Config.php'; 
use Mts\Request\V20140618 as Mts;

function initMtsClient($accessKeyId, $accessKeySecret) {
    $regionId = 'cn-shanghai';  // 服務(wù)接入?yún)^(qū)域
    $profile = DefaultProfile::getProfile($regionId, $accessKeyId, $accessKeySecret);
    return new DefaultAcsClient($profile);
}

try {
    $client = initMtsClient(getenv('ALIBABA_CLOUD_ACCESS_KEY_ID'), getenv('ALIBABA_CLOUD_ACCESS_KEY_SECRET'));
    $response = submitClipJob($client);
    print_r($response);
} catch (Exception $e) {
    print $e->getMessage()."\n";
}

function submitClipJob($client) {
    $pipelineId = 'd7cedd984be7dd63395c*****';   #管道ID  可在控制臺(tái)查看
    $templateId = "S00000001-100020"; #轉(zhuǎn)碼模板ID,可在控制臺(tái)查看
    $ossLocation = 'oss-cn-shanghai';
    $bucket = '<bucket name>';
    $ossInputObject = 'input.mp4';
    $ossOutputObject = 'output.mp4';
    #水印模板ID,可在控制臺(tái)查看,僅適用圖片、動(dòng)圖水印
    $watermarkTemplateId = '0ba6fb1ab7c5271a2e1293*****';
    $imageWatermarkObject = 'logo.png';
    $videoWatermarkObject = 'logo.mov';
    $request = new Mts\SubmitJobsRequest();
    # input參數(shù)
    $input = array('Location' => $ossLocation,
               'Bucket' => $bucket,
               'Object' => urlencode($ossInputObject));

    # output參數(shù)
    $output = array('OutputObject' => urlencode($ossOutputObject));
    $output['TemplateId'] = $templateId;
    # 圖片水印
    $imageWatermarkInput = array(
                            'Location' => $ossLocation,
                            'Bucket' => $bucket,
                            'Object' => urlencode($imageWatermarkObject)
                            );
    $imageWatermark = array(
                    'WaterMarkTemplateId' => $watermarkTemplateId,
                    'Type' => 'Image',
                    'InputFile' => $imageWatermarkInput,
                    'ReferPos' => 'TopRight',
                    'Width' => 0.05,
                    'Dx' => 0,
                    'Dy'=> 0
                    );
    # 文字水印
    $textConfig = array(
                # 需傳入Base64后的Content值
                'Content' => '5rWL6K+V5paH5a2X5rC05Y2w',
                'FontName' => 'SimSun',
                'FontSize' => 16,
                'FontColor' => 'Red',
                'FontAlpha' => 0.5,
                'Top' => 10,
                'Left' => 10
                );
    $textWatermark = array(
                    'Type' => 'Text',
                    'TextWaterMark' => $textWatermark
                    );
    # 動(dòng)圖水印
    $videoWatermarkInput = array (
                            'Location' => $ossLocation,
                            'Bucket' => $bucket,
                            'Object' => urlencode($videoWatermarkObject)
                            );
    $videoWatermark = array(
                    'WaterMarkTemplateId' => $watermarkTemplateId,
                    'Type' => 'Image',
                    'InputFile'=> $videoWatermarkInput,
                    'ReferPos' => 'BottomLeft',
                    'Height' => 240,
                    'Dx' => 0,
                    'Dy' => 0
                    );
    # 水印數(shù)組,最多支持4個(gè)水印
    $watermarks = array($imageWatermark, $textWatermark, $videoWatermark);
    $output['WaterMarks'] = $watermarks;
    $outputs = array($output);
    # 請(qǐng)求參數(shù)
    $request->setInput(json_encode($input));
    $request->setOUtputs(json_encode($outputs));
    $request->setOutputBucket($bucket);
    $request->setOutputLocation($ossLocation);
    $request->setPipelineId($pipelineId);
    return $client->getAcsResponse($request);
}

相關(guān)文檔