List of usage examples for com.amazonaws.services.elastictranscoder.model CreateJobRequest CreateJobRequest
CreateJobRequest
From source file:com.amediamanager.service.VideoServiceImpl.java
License:Apache License
@Override public void createVideoPreview(Video video) { String pipelineId = config.getProperty(ConfigProps.TRANSCODE_PIPELINE); String presetId = config.getProperty(ConfigProps.TRANSCODE_PRESET); if (pipelineId == null || presetId == null) { return;/*from w w w . j ava2s . com*/ } CreateJobRequest encodeJob = new CreateJobRequest().withPipelineId(pipelineId) .withInput(new JobInput().withKey(video.getOriginalKey()).withAspectRatio("auto") .withContainer("auto").withFrameRate("auto").withInterlaced("auto").withResolution("auto")) .withOutputKeyPrefix("uploads/converted/" + video.getOwner() + "/") .withOutput(new CreateJobOutput().withKey(UUID.randomUUID().toString()).withPresetId(presetId) .withThumbnailPattern("thumbs/" + UUID.randomUUID().toString() + "-{count}")); try { CreateJobResult result = transcoderClient.createJob(encodeJob); video.setTranscodeJobId(result.getJob().getId()); video.setThumbnailKey("static/img/in_progress_poster.png"); save(video); } catch (AmazonServiceException e) { LOG.error("Failed creating transcode job for video {}", video.getId(), e); } }
From source file:org.alanwilliamson.amazon.transcoder.job.Create.java
License:Open Source License
public cfData execute(cfSession _session, cfArgStructData argStruct) throws cfmRunTimeException { AmazonKey amazonKey = getAmazonKey(_session, argStruct); AmazonElasticTranscoder et = getAmazonElasticTranscoder(amazonKey); CreateJobRequest cjr = new CreateJobRequest(); cjr.setPipelineId(getNamedStringParam(argStruct, "pipelineid", null)); if (cjr.getPipelineId() == null || cjr.getPipelineId().isEmpty()) throwException(_session, "please provide a valid pipelineid"); cjr.setOutputKeyPrefix(getNamedStringParam(argStruct, "outputkeyprefix", null)); if (cjr.getOutputKeyPrefix() != null && cjr.getOutputKeyPrefix().isEmpty()) throwException(_session, "please provide a valid outputkeyprefix"); // Handle the input cfStructData input = getNamedStructParam(_session, argStruct, "input", null); if (input == null) throwException(_session, "please provide a 'input'"); JobInput jobinput = new JobInput(); if (input.containsKey("aspectratio")) jobinput.setAspectRatio(input.getData("aspectratio").getString()); if (input.containsKey("container")) jobinput.setContainer(input.getData("container").getString()); if (input.containsKey("framerate")) jobinput.setFrameRate(input.getData("framerate").getString()); if (input.containsKey("interlaced")) jobinput.setInterlaced(input.getData("interlaced").getString()); if (input.containsKey("key")) jobinput.setKey(input.getData("key").getString()); if (input.containsKey("resolution")) jobinput.setResolution(input.getData("resolution").getString()); if (input.containsKey("encryption")) jobinput.setEncryption(getEncryption((cfStructData) input.getData("encryption"))); cjr.setInput(jobinput);/* w ww . j av a 2s . co m*/ // Set the output cfArrayData outputArr = getNamedArrayParam(_session, argStruct, "outputs", null); if (outputArr == null) throwException(_session, "please provide 'outputs'"); List<CreateJobOutput> outputs = new LinkedList(); for (int x = 0; x < outputArr.size(); x++) outputs.add(getCreateJobOutput((cfStructData) outputArr.getData(x + 1))); cjr.setOutputs(outputs); // Now after collection all that; create the actual pipeline try { CreateJobResult cpres = et.createJob(cjr); return new cfStringData(cpres.getJob().getId()); } catch (Exception e) { throwException(_session, "AmazonElasticTranscoder: " + e.getMessage()); return cfBooleanData.TRUE; } }
From source file:org.nuxeo.aws.elastictranscoder.AWSElasticTranscoder.java
License:Open Source License
protected void createElasticTranscoderJob() { // (using code from the AWS code sample in // JobStatusNotificationsSample.java) // Setup the job input JobInput jobInput = new JobInput().withKey(inputKey); // We create just one job here. Look at the code sample in // JobStatusNotificationsSample.java to see how to create several jobs // in one call. CreateJobOutput output = new CreateJobOutput().withKey(outputKey); output.withPresetId(presetId);/* ww w. ja v a 2s. co m*/ // Create a job on the specified pipeline and get the job ID CreateJobRequest createJobRequest = new CreateJobRequest(); createJobRequest.withPipelineId(pipelineId); createJobRequest.withInput(jobInput); createJobRequest.withOutput(output); CreateJobResult cjr = genericAwsClient.getElasticTranscoder().createJob(createJobRequest); awsJobId = cjr.getJob().getId(); }