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

水印

在視頻中添加可見的明水印(例如,企業Logo、電視臺臺標),可以突出品牌和版權,增加產品識別度。媒體處理支持圖片水印動畫水印文字水印三種水印類型,您可以按需選擇。本文提供了Node.js SDK設置水印的操作步驟及完整的代碼示例。

完整代碼

import Console from '@alicloud/tea-console';
import OpenApi, * as $OpenApi from '@alicloud/openapi-client';
import Env from '@alicloud/darabonba-env';
import Util from '@alicloud/tea-util';
import mts20140618, * as $mts20140618 from '@alicloud/mts20140618';
import * as $tea from '@alicloud/tea-typescript';

/**
 * Node.js環境版本為8.x及以上。
 * 安裝阿里云SDK  npm install @alicloud/pop-core --save
 * 安裝Credentials工具。  npm install @alicloud/credentials
 * 安裝MPS SDK npm install --save @alicloud/mts20140618
 * 
 */
/** 管道ID  可在控制臺查看 */
var pipelineId = "d7cedd984be7dd63395c*****"; 
/** 轉碼模板ID,m3u8模板,按需配置 */
var templateId = "S00000001-100020"; 
var ossLocation = "oss-cn-shanghai";
var bucket = "<bucket name>";
var ossInputObject = "input.mp4";
var ossOutputObject = "output.mp4";
/** 水印模板ID 可在控制臺創建查看 僅圖片、動圖水印有效 */
var watermarkTemplateId = "0dc48b5f04945d6717b8fd3*******"; 
var imageWaterMarkObject = "logo.png";
var videoWatermarkObject = "watermark.mov";


export default class Client {

/** 初始化 Client */
static async createClient(accessKeyId: string, accessKeySecret: string, regionId: string): Promise<mts20140618> {
    let config = new $OpenApi.Config({ });
    config.accessKeyId = accessKeyId;
    config.accessKeySecret = accessKeySecret;
    /** 接口服務地域 */
    config.regionId = "cn-shanghai";
    return new mts20140618(config);
}

static async main(args: string[]): Promise<void> {
    let client = await Client.createClient(Env.getEnv("ALIBABA_CLOUD_ACCESS_KEY_ID"), Env.getEnv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), args[0]);

    let request = new $mts20140618.SubmitJobsRequest({
        input: inputParam(),
        outputs: outputParam(),
        outputBucket: bucket,
        pipelineId: pipelineId,
        outputLocation: ossLocation
    });
    let response = await client.submitJobs(request);
    Console.log(Util.toJSONString($tea.toMap(response)));
}
}

Client.main(process.argv.slice(2));


function inputParam() {
    var input:any = {};
    input.Location = ossLocation;
    input.Bucket = bucket;
    input.Object = encodeURIComponent(ossInputObject);
    return JSON.stringify(input);
}

function outputParam() {
    var outputOSSObject = encodeURIComponent(ossOutputObject);
    var output:any = {};
    output.OutputObject = outputOSSObject;
    output.TemplateId = templateId;
    output.WaterMarks = waterMarks();

    var outputs = new Array();
    outputs.push(output);

    return JSON.stringify(outputs);
}

function waterMarks(){

    /**圖片水印配置 */
    var imageWatermarkInput = {
        Location: ossLocation,
        Bucket: bucket,
        Object: encodeURIComponent(imageWaterMarkObject)
    };

    var imageWatermark = {
        WaterMarkTemplateId: watermarkTemplateId,
        Type: "Image",
        InputFile: imageWatermarkInput,
        ReferPos: 'TopRight',
        Width: "0.05",
        Dx: "0",
        Dy: "0"
    };
    /** 文字水印配置 */
    var textConfig = {
        /** 需傳入Base64后的Content值 */
        Content: "5rWL6K+V5paH5a2X5rC05Y2w",
        FontName: "SimSun",
        FontSize: "16",
        FontColor: "Red",
        FontAlpha: "0.5",
        Top: "10",
        Left: "10",
    };
    var textWatermark = {
        Type: "Text",
        TextWaterMark: JSON.stringify(textConfig)
    };
    /** 動圖水印配置 */
    var videoWatermarkInput = {
        Location: ossLocation,
        Bucket: bucket,
        Object: encodeURIComponent(videoWatermarkObject)
    };
    var videoWatermark = {
        WaterMarkTemplateId: watermarkTemplateId,
        Type: "Image",
        InputFile: videoWatermarkInput,
        ReferPos: "BottomLeft",
        Height: "240",
        Dx: "0",
        Dy: "0"
    };

    var waterMarks = new Array();
    waterMarks.push(imageWatermark);
    waterMarks.push(textWatermark);
    waterMarks.push(videoWatermark);

    return waterMarks;
}

相關文檔