Search in sources :

Example 11 with MediaTemplateRequest

use of com.qcloud.cos.model.ciModel.template.MediaTemplateRequest in project cos-java-sdk-v5 by tencentyun.

the class TranscodeTemplateDemo method createMediaTemplate.

/**
 * CreateMediaTemplate 用于新增转码模板。
 *
 * @param client
 */
public static void createMediaTemplate(COSClient client) throws UnsupportedEncodingException {
    // 1.创建模板请求对象
    MediaTemplateRequest request = new MediaTemplateRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setTag("Transcode");
    request.setName("mark-test-2");
    request.getContainer().setFormat("mp4");
    // 2.1 添加video对象的值
    MediaVideoObject video = request.getVideo();
    video.setCodec("H.264");
    video.setProfile("high");
    video.setBitrate("1000");
    video.setWidth("1280");
    video.setFps("30");
    video.setPreset("medium");
    video.setBufSize("1000");
    video.setMaxrate("10");
    // 2.2  添加audio对象的值
    MediaAudioObject audio = request.getAudio();
    audio.setCodec("aac");
    audio.setSamplerate("44100");
    audio.setBitrate("128");
    audio.setChannels("1");
    // 2.3 添加TransConfig对象的值
    MediaTransConfigObject transConfig = request.getTransConfig();
    transConfig.setAdjDarMethod("scale");
    transConfig.setIsCheckReso("false");
    transConfig.setResoAdjMethod("1");
    // 2.4 添加TimeInterval对象的值
    MediaTimeIntervalObject timeInterval = request.getTimeInterval();
    timeInterval.setStart("0");
    timeInterval.setDuration("60");
    // 3. 调用接口 获取模板响应对象
    MediaTemplateResponse response = client.createMediaTemplate(request);
    System.out.println(response);
}
Also used : MediaTemplateResponse(com.qcloud.cos.model.ciModel.template.MediaTemplateResponse) MediaAudioObject(com.qcloud.cos.model.ciModel.job.MediaAudioObject) MediaTimeIntervalObject(com.qcloud.cos.model.ciModel.job.MediaTimeIntervalObject) MediaTemplateRequest(com.qcloud.cos.model.ciModel.template.MediaTemplateRequest) MediaTransConfigObject(com.qcloud.cos.model.ciModel.job.MediaTransConfigObject) MediaVideoObject(com.qcloud.cos.model.ciModel.job.MediaVideoObject)

Example 12 with MediaTemplateRequest

use of com.qcloud.cos.model.ciModel.template.MediaTemplateRequest in project cos-java-sdk-v5 by tencentyun.

the class TranscodeTemplateDemo method describeMediaTemplates.

/**
 * DescribeMediaTemplates 用于查询转码模板。
 *
 * @param client
 */
public static void describeMediaTemplates(COSClient client) {
    // 1.创建模板请求对象
    MediaTemplateRequest request = new MediaTemplateRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setTag("Transcode");
    // 3.调用接口,获取模板响应对象
    MediaListTemplateResponse response = client.describeMediaTemplates(request);
    List<MediaTemplateObject> templateList = response.getTemplateList();
    for (MediaTemplateObject mediaTemplateObject : templateList) {
        System.out.println(mediaTemplateObject);
    }
}
Also used : MediaTemplateRequest(com.qcloud.cos.model.ciModel.template.MediaTemplateRequest) MediaTemplateObject(com.qcloud.cos.model.ciModel.template.MediaTemplateObject) MediaListTemplateResponse(com.qcloud.cos.model.ciModel.template.MediaListTemplateResponse)

Example 13 with MediaTemplateRequest

use of com.qcloud.cos.model.ciModel.template.MediaTemplateRequest in project cos-java-sdk-v5 by tencentyun.

the class TranscodeTemplateDemo method updateMediaTemplate.

/**
 * UpdateMediaTemplate 用于更新转码模板。
 *
 * @param client
 */
public static void updateMediaTemplate(COSClient client) throws UnsupportedEncodingException {
    // 1.创建模板请求对象
    MediaTemplateRequest request = new MediaTemplateRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setTemplateId("t138b37dc82e59422d85f03bb7a8*****");
    request.setTag("Transcode");
    request.setName("mark-test-update-01");
    request.getContainer().setFormat("mp4");
    MediaVideoObject video = request.getVideo();
    video.setCodec("H.264");
    video.setProfile("high");
    video.setBitrate("1000");
    video.setWidth("1280");
    video.setFps("30");
    video.setPreset("medium");
    video.setBufSize("1000");
    video.setMaxrate("10");
    MediaAudioObject audio = request.getAudio();
    audio.setCodec("aac");
    audio.setSamplerate("44100");
    audio.setBitrate("128");
    audio.setChannels("1");
    MediaTransConfigObject transConfig = request.getTransConfig();
    transConfig.setAdjDarMethod("scale");
    transConfig.setIsCheckReso("false");
    transConfig.setResoAdjMethod("1");
    MediaTimeIntervalObject timeInterval = request.getTimeInterval();
    timeInterval.setStart("1");
    timeInterval.setDuration("30");
    // 3.调用接口,获取模板响应对象
    Boolean aBoolean = client.updateMediaTemplate(request);
    System.out.println(aBoolean);
}
Also used : MediaAudioObject(com.qcloud.cos.model.ciModel.job.MediaAudioObject) MediaTimeIntervalObject(com.qcloud.cos.model.ciModel.job.MediaTimeIntervalObject) MediaTemplateRequest(com.qcloud.cos.model.ciModel.template.MediaTemplateRequest) MediaTransConfigObject(com.qcloud.cos.model.ciModel.job.MediaTransConfigObject) MediaVideoObject(com.qcloud.cos.model.ciModel.job.MediaVideoObject)

Aggregations

MediaTemplateRequest (com.qcloud.cos.model.ciModel.template.MediaTemplateRequest)13 MediaListTemplateResponse (com.qcloud.cos.model.ciModel.template.MediaListTemplateResponse)4 MediaTemplateObject (com.qcloud.cos.model.ciModel.template.MediaTemplateObject)4 MediaTemplateResponse (com.qcloud.cos.model.ciModel.template.MediaTemplateResponse)4 MediaAudioObject (com.qcloud.cos.model.ciModel.job.MediaAudioObject)2 MediaTimeIntervalObject (com.qcloud.cos.model.ciModel.job.MediaTimeIntervalObject)2 MediaTransConfigObject (com.qcloud.cos.model.ciModel.job.MediaTransConfigObject)2 MediaVideoObject (com.qcloud.cos.model.ciModel.job.MediaVideoObject)2 Test (org.junit.Test)1