com.amazonaws.services.elastictranscoder.model.CreateJobOutput Java Examples

The following examples show how to use com.amazonaws.services.elastictranscoder.model.CreateJobOutput. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JobStatusNotificationsSample.java    From aws-doc-sdk-examples with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a job in Elastic Transcoder using the configured pipeline, input
 * key, preset, and output key prefix.
 * @return Job ID of the job that was created in Elastic Transcoder.
 * @throws Exception
 */
private static String createElasticTranscoderJob() throws Exception {
    
    // Setup the job input using the provided input key.
    JobInput input = new JobInput()
        .withKey(INPUT_KEY);
    
    // Setup the job output using the provided input key to generate an output key.
    List<CreateJobOutput> outputs = new ArrayList<CreateJobOutput>();
    CreateJobOutput output = new CreateJobOutput()
        .withKey(TranscoderSampleUtilities.inputKeyToOutputKey(INPUT_KEY))
        .withPresetId(PRESET_ID);
    outputs.add(output);
    
    // Create a job on the specified pipeline and return the job ID.
    CreateJobRequest createJobRequest = new CreateJobRequest()
        .withPipelineId(PIPELINE_ID)
        .withOutputKeyPrefix(OUTPUT_KEY_PREFIX)
        .withInput(input)
        .withOutputs(outputs);
    return amazonElasticTranscoder.createJob(createJobRequest).getJob().getId();
}
 
Example #2
Source File: ElasticTranscoderImpl.java    From studio with GNU General Public License v3.0 6 votes vote down vote up
protected CreateJobRequest getCreateJobRequest(String inputKey, String baseKey, TranscoderProfile profile) {
    JobInput jobInput = new JobInput();
    jobInput.setKey(inputKey);

    List<CreateJobOutput> jobOutputs = new ArrayList<>(profile.getOutputs().size());

    for (TranscoderOutput output : profile.getOutputs()) {
        jobOutputs.add(getCreateJobOutput(baseKey, output));
    }

    CreateJobRequest jobRequest = new CreateJobRequest();
    jobRequest.setPipelineId(profile.getPipelineId());
    jobRequest.setInput(jobInput);
    jobRequest.setOutputs(jobOutputs);

    return jobRequest;
}
 
Example #3
Source File: ElasticTranscoderImpl.java    From studio with GNU General Public License v3.0 5 votes vote down vote up
protected CreateJobOutput getCreateJobOutput(String baseKey, TranscoderOutput output) {
    CreateJobOutput jobOutput = new CreateJobOutput();
    jobOutput.setPresetId(output.getPresetId());
    jobOutput.setKey(baseKey + output.getOutputKeySuffix());

    if (StringUtils.isNotEmpty(output.getThumbnailSuffixFormat())) {
        jobOutput.setThumbnailPattern(baseKey + output.getThumbnailSuffixFormat());
    }

    return jobOutput;
}
 
Example #4
Source File: HlsJobCreationSample.java    From aws-doc-sdk-examples with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a job which outputs an HLS playlist for adaptive bitrate playback.
 * @return Job that was created by Elastic Transcoder.
 * @throws Exception
 */
private static Job createElasticTranscoderHlsJob() throws Exception {
    
    // Setup the job input using the provided input key.
    JobInput input = new JobInput()
        .withKey(INPUT_KEY);
    
    // Setup the job outputs using the HLS presets.
    String outputKey = TranscoderSampleUtilities.inputKeyToOutputKey(INPUT_KEY);
    CreateJobOutput hlsAudio = new CreateJobOutput()
        .withKey("hlsAudio/" + outputKey)
        .withPresetId(HLS_64K_AUDIO_PRESET_ID)
        .withSegmentDuration(SEGMENT_DURATION);
    CreateJobOutput hls0400k = new CreateJobOutput()
        .withKey("hls0400k/" + outputKey)
        .withPresetId(HLS_0400K_PRESET_ID)
        .withSegmentDuration(SEGMENT_DURATION);
    CreateJobOutput hls0600k = new CreateJobOutput()
        .withKey("hls0600k/" + outputKey)
        .withPresetId(HLS_0600K_PRESET_ID)
        .withSegmentDuration(SEGMENT_DURATION);
    CreateJobOutput hls1000k = new CreateJobOutput()
        .withKey("hls1000k/" + outputKey)
        .withPresetId(HLS_1000K_PRESET_ID)
        .withSegmentDuration(SEGMENT_DURATION);
    CreateJobOutput hls1500k = new CreateJobOutput()
        .withKey("hls1500k/" + outputKey)
        .withPresetId(HLS_1500K_PRESET_ID)
        .withSegmentDuration(SEGMENT_DURATION);
    CreateJobOutput hls2000k = new CreateJobOutput()
        .withKey("hls2000k/" + outputKey)
        .withPresetId(HLS_2000K_PRESET_ID)
        .withSegmentDuration(SEGMENT_DURATION);
    List<CreateJobOutput> outputs = Arrays.asList(hlsAudio, hls0400k, hls0600k, hls1000k, hls1500k, hls2000k);
    
    // Setup master playlist which can be used to play using adaptive bitrate.
    CreateJobPlaylist playlist = new CreateJobPlaylist()
        .withName("hls_" + outputKey)
        .withFormat("HLSv3")
        .withOutputKeys(hlsAudio.getKey(), hls0400k.getKey(), hls0600k.getKey(), hls1000k.getKey(), hls1500k.getKey(), hls2000k.getKey());
    
    // Create the job.
    CreateJobRequest createJobRequest = new CreateJobRequest()
        .withPipelineId(PIPELINE_ID)
        .withInput(input)
        .withOutputKeyPrefix(OUTPUT_KEY_PREFIX + outputKey + "/")
        .withOutputs(outputs)
        .withPlaylists(playlist);
    return amazonElasticTranscoder.createJob(createJobRequest).getJob();
}
 
Example #5
Source File: Create.java    From openbd-core with GNU General Public License v3.0 4 votes vote down vote up
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);
	
	
	// 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;
	}
}