本文整理汇总了Java中com.amazonaws.services.elastictranscoder.model.VideoParameters类的典型用法代码示例。如果您正苦于以下问题:Java VideoParameters类的具体用法?Java VideoParameters怎么用?Java VideoParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VideoParameters类属于com.amazonaws.services.elastictranscoder.model包,在下文中一共展示了VideoParameters类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: provisionPreset
import com.amazonaws.services.elastictranscoder.model.VideoParameters; //导入依赖的package包/类
private String provisionPreset() {
String presetId = config.getProperty(ConfigProps.TRANSCODE_PRESET);
if (presetId == null) {
LOG.info("Provisioning ETS Preset.");
state = ProvisionState.PROVISIONING;
Map<String, String> codecOptions = new HashMap<String, String>();
codecOptions.put("Profile", "main");
codecOptions.put("Level", "3.1");
codecOptions.put("MaxReferenceFrames", "3");
VideoParameters video = new VideoParameters()
.withCodec("H.264")
.withCodecOptions(codecOptions)
.withKeyframesMaxDist("90")
.withFixedGOP("false")
.withBitRate("2200")
.withFrameRate("30")
.withMaxWidth("1280")
.withMaxHeight("720")
.withSizingPolicy("ShrinkToFit")
.withPaddingPolicy("NoPad")
.withDisplayAspectRatio("auto");
AudioParameters audio = new AudioParameters()
.withCodec("AAC")
.withSampleRate("44100")
.withBitRate("160")
.withChannels("2");
Thumbnails thumbnails = new Thumbnails()
.withFormat("png")
.withInterval("60")
.withMaxWidth("500")
.withMaxHeight("300")
.withSizingPolicy("ShrinkToFit")
.withPaddingPolicy("NoPad");
CreatePresetRequest presetRequest = new CreatePresetRequest()
.withName("amm-reinvent-preset-" + UUID.randomUUID().toString().replace("-", "").substring(0, 20).toUpperCase())
.withDescription("Preset used by aMediaManager re:Invent 2013")
.withContainer("mp4")
.withVideo(video)
.withAudio(audio)
.withThumbnails(thumbnails);
try {
CreatePresetResult result = transcoderClient.createPreset(presetRequest);
presetId = result.getPreset().getId();
config.getConfigurationProvider().persistNewProperty(ConfigProps.TRANSCODE_PRESET, presetId);
LOG.info("Preset {} created. Persisting to configuration provider.", presetId);
} catch (AmazonServiceException e) {
LOG.error("Failed creating transcoder preset {}", presetRequest.getName(), e);
state = ProvisionState.UNPROVISIONED;
}
}
return presetId;
}