模板(preset)使用示例

最近更新时间:2021-08-09 15:58:43

查看PDF

需求场景:我想对mp4文件做hls切片。


{

    "Preset": "mypreset_hls",

    "Description": "demo_hls",

    "PresetType": "avtrans",

    "Param":{

        "f":"hls",

        "segment_time":6,

        "segfile_acl":"public-read",

        "AUDIO": {

            "acodec": "copy"

        },

        "VIDEO": {            

            "vcodec": "copy"

        }

    }

}

需求场景:我只想在源视频上加水印,但不打算改变源视频的分辨率、码率等参数。

{

    "Preset": "mypreset_0",

    "Description": "demo_logo",

    "PresetType": "avtrans",

    "Param":{

        "f":"mp4",

        "LOGOS":[

            [

                {

                    "url":"http://ks3-cn-beijing-internal.ksyun.com/{bucket_name}/{object_name}",  //logo路径需是ks3内网地址,属性为public

                    "logotype":"image",

                    "usage_scenario":"ALL",

                    "shortSide": 480,// 或者"optimal_w": 640, 或者"optimal_h": 480,

                    "disable_scale" : 0,

                    "offsetX": -10,

                    "offsetY": 10

                }

            ]

        ]

    }

}

需求场景:我为了水印效果更好,不想水印被过度缩放,所以准备了不同尺寸的2个水印logo文件,想根据转出视频不同尺寸加相应的水印logo(只加一个)。


{

    "Preset": "mypreset_logoselect",

    "Description": "demo_logoselect",

    "PresetType": "avtrans",

    "Param":{

        "f":"mp4",

        "AUDIO": {

            "acodec": "copy"

        },

        "VIDEO": {            

            "vcodec": "h264",

            "preset":"veryfast"

        },

        "LOGOS":[

            [

                {

                    "url":"http://ks3-cn-beijing-internal.ksyun.com/{bucket_name}/{object_name0}",

                    "logotype":"image",

                    "usage_scenario":"ALL",

                    "shortSide": 480,// 或者"optimal_w": 640, 或者"optimal_h": 480,

                    "disable_scale" : 0,

                    "offsetX": -10,

                    "offsetY": 10

                },

                {

                    "url":"http://ks3-cn-beijing-internal.ksyun.com/{bucket_name}/{object_name1}",

                    "logotype":"image",

                    "usage_scenario":"ALL",

                    "shortSide": 720,// 或者"optimal_w": 1280, 或者"optimal_h": 720,

                    "disable_scale" : 0,

                    "offsetX": -15,

                    "offsetY": 15

                }

            ]

        ]

    }

}

需求场景:我想加多个水印logo,以及水印logo要在视频开始后某个时间点开始显示。

{

    "Preset": "mypreset_multilogo",

    "Description": "demo_multilogo",

    "PresetType": "avtrans",

    "Param":{

        "f":"mp4",

        "AUDIO": {

            "acodec": "copy"

        },

        "VIDEO": {            

            "vr": "25",

            "vb": "500k",

            "vcodec": "h265",

            "height": 480,

            "as": 1,

            "preset":"veryfast"

        },

        "LOGOS":[

            [

                {

                    "url":"http://ks3-cn-beijing-internal.ksyun.com/{bucket_name}/{object_name_0}", //第一个logo路径

                    "logotype":"image",

                    "usage_scenario":"ALL",

                    "shortSide": 480,// 或者"optimal_w": 640, 或者"optimal_h": 480,

                    "disable_scale" : 0,

                    "offsetX": -10,

                    "offsetY": 10

                }

            ],

            [

  			    {

                    "url":"http://ks3-cn-beijing-internal.ksyun.com/{bucket_name}/{object_name_1}", //第二个logo路径

                    "logotype":"image",

                    "usage_scenario":"ALL",

                    "shortSide": 480,// 或者"optimal_w": 640, 或者"optimal_h": 480,

                    "disable_scale" : 0,

                    "offsetX": -10,

                    "offsetY": -10,

                    "ss": 5  //视频开始5秒后开始显示此logo

                }

			]

        ]

    }

}

需求场景:我想对源视频拼接片头片尾的同时加多个水印,且第一个水印只显示在源视频上,第二个水印的显示贯穿全程。


{

    "Preset": "mypreset_multilogo",

    "Description": "demo_multilogo",

    "PresetType": "avtrans",

    "Param":{

        "f":"mp4",

        "AUDIO": {

            "acodec": "copy"

        },

        "VIDEO": {            

            "vr": "25",

            "vb": "500k",

            "vcodec": "h265",

            "height": 480,

            "as": 1,

            "preset":"veryfast"

        },

        "LOGOS":[

            [

                {

                    "url":"http://ks3-cn-beijing-internal.ksyun.com/{bucket_name}/{object_name_0}", //第一个logo路径

                    "logotype":"image",

                    "usage_scenario":"ALL",

                    "effect_objects":"1",  //表示logo加在拼接前的第二个视频上。

                    "shortSide": 480,// 或者"optimal_w": 640, 或者"optimal_h": 480,

                    "disable_scale" : 0,

                    "offsetX": -10,

                    "offsetY": 10

                }

            ],

            [

  			    {

                    "url":"http://ks3-cn-beijing-internal.ksyun.com/{bucket_name}/{object_name_1}", //第二个logo路径

                    "logotype":"image",

                    "usage_scenario":"ALL",

                    "effect_objects":"",  //设为空,表示logo加在拼接片头片尾后的视频上。

                    "shortSide": 480,// 或者"optimal_w": 640, 或者"optimal_h": 480,

                    "disable_scale" : 0,

                    "offsetX": -10,

                    "offsetY": -10,

                    "ss": 5  //视频开始5秒后开始显示此logo

                }

			]

        ]

    }

}

需求场景:我想对源视频拼接片头片尾


拼接任务,模板设为普通的avtrans类型,在创建任务的时候SrcInfo设置为数组即可。

需求场景:我想对视频文件做剪切处理。

{
    "Preset": "avtrans_clip",
    "Description": "剪切",
    "PresetType": "avtrans",
    "Param": {
            "f": "mp4",
            "CLIP": {
                "clip_type": 1,
                "clip_extent": [
                    {
                        "starttime": 10,
                        "endtime": 20
                    },
                    {
                        "starttime": 30,
                        "endtime": 40
                    }
                ]
            },
            "VIDEO": {
                "vr": "25",
                "vb": "1000k",
                "vcodec": "h264",
                "shortSide": 720,
                "as": 1,
                "rotate": "0",
                "vn": 0
            },
            "AUDIO": {
                "ar": "44100",
                "ab": "64k",
                "acodec": "aac",
                "an": 0
            }
        }
    }

扩展参数添加水印参数示例:

"ExtParam":"{\"f\":\"flv\",\"LOGOS\":[[{\"dx\":\"20\",\"disable_scale\":1,\"dy\":\"100\",\"referPos\":\"BottomRight\",\"logotype\":\"image\",\"url\":\"image.jpg\",\"usage_scenario\":\"WgeH\"}]]}"

集智高清参数示例:

{
    "Preset": "template_H265_H360_kshd_v",
    "Description": "transcode preset for video: [codec_type: H265, definition: 360]",
    "PresetType": "avtrans",
    "Kshd": 1,
    "Param": {
        "f": "mp4",
        "zdParams": "{\"video_type\": 3}",
        "AUDIO": {
            "ab": "64k",
            "ar": "48000",
            "acodec": "aac"
        },
        "VIDEO": {
            "vr": "25",
            "vcodec": "h265",
            "height": 360,
            "as": 1,
            "preset": "slower",
            "codecParams": "rctype=3:crf=30:qpmin=18:qpmax=38:longterm=0:rasl=0:lookahead=16"
        }
    }
}

文档内容是否对您有帮助?

根本没帮助
文档较差
文档一般
文档不错
文档很好

在文档使用中是否遇到以下问题

内容不全,不深入
内容更新不及时
描述不清晰,比较混乱
系统或功能太复杂,缺乏足够的引导
内容冗长

更多建议

0/200

评价建议不能为空

提交成功!

非常感谢您的反馈,我们会继续努力做到更好!

问题反馈