本文整理匯總了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;
}