Skip to content

create_preset

create_preset(
    name: Name,
    container: PresetContainer,
    *,
    config_overrides: Optional[ElasticTranscoderClientConfig] = None,
    description: Optional[Description] = None,
    video: Optional[VideoParameters] = None,
    audio: Optional[AudioParameters] = None,
    thumbnails: Optional[Thumbnails] = None,
) -> CreatePresetResponse

The CreatePreset operation creates a preset with settings that you specify.

Elastic Transcoder checks the CreatePreset settings to ensure that they meet Elastic Transcoder requirements and to determine whether they comply with H.264 standards. If your settings are not valid for Elastic Transcoder, Elastic Transcoder returns an HTTP 400 response (ValidationException) and does not create the preset. If the settings are valid for Elastic Transcoder but aren't strictly compliant with the H.264 standard, Elastic Transcoder creates the preset and returns a warning message in the response. This helps you determine whether your settings comply with the H.264 standard while giving you greater flexibility with respect to the video that Elastic Transcoder produces.

Elastic Transcoder uses the H.264 video-compression format. For more information, see the International Telecommunication Union publication Recommendation ITU-T H.264: Advanced video coding for generic audiovisual services.

Parameters:

  • name (Name) –

    The name of the preset. We recommend that the name be unique within the AWS account, but uniqueness is not enforced.

  • description (Optional[Description], default: None ) –

    A description of the preset.

  • container (PresetContainer) –

    The container type for the output file. Valid values include flac, flv, fmp4, gif, mp3, mp4, mpg, mxf, oga, ogg, ts, and webm.

  • video (Optional[VideoParameters], default: None ) –

    A section of the request body that specifies the video parameters.

  • audio (Optional[AudioParameters], default: None ) –

    A section of the request body that specifies the audio parameters.

  • thumbnails (Optional[Thumbnails], default: None ) –

    A section of the request body that specifies the thumbnail parameters, if any.

Raises:

  • AccessDeniedException –

    General authentication failure. The request was not signed correctly.

  • InternalServiceException –

    Elastic Transcoder encountered an unexpected exception while trying to fulfill the request.

  • LimitExceededException –

    Too many operations for a given AWS account. For example, the number of pipelines exceeds the maximum allowed.

  • ValidationException –

    One or more required parameter values were not provided in the request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_elastic_transcoder/_services/elastic_transcoder.py
def create_preset(
    self,
    name: "capo_elastic_transcoder.types.name.Name",
    container: "capo_elastic_transcoder.types.preset_container.PresetContainer",
    *,
    config_overrides: Optional[ElasticTranscoderClientConfig] = None,
    description: Optional[
        "capo_elastic_transcoder.types.description.Description"
    ] = None,
    video: Optional[
        "capo_elastic_transcoder.types.video_parameters.VideoParameters"
    ] = None,
    audio: Optional[
        "capo_elastic_transcoder.types.audio_parameters.AudioParameters"
    ] = None,
    thumbnails: Optional[
        "capo_elastic_transcoder.types.thumbnails.Thumbnails"
    ] = None,
) -> "capo_elastic_transcoder.types.create_preset_response.CreatePresetResponse":
    """<p>The CreatePreset operation creates a preset with settings that you specify.</p> <important> <p>Elastic Transcoder checks the CreatePreset settings to ensure that they meet Elastic Transcoder requirements and to determine whether they comply with H.264 standards. If your settings are not valid for Elastic Transcoder, Elastic Transcoder returns an HTTP 400 response (<code>ValidationException</code>) and does not create the preset. If the settings are valid for Elastic Transcoder but aren't strictly compliant with the H.264 standard, Elastic Transcoder creates the preset and returns a warning message in the response. This helps you determine whether your settings comply with the H.264 standard while giving you greater flexibility with respect to the video that Elastic Transcoder produces.</p> </important> <p>Elastic Transcoder uses the H.264 video-compression format. For more information, see the International Telecommunication Union publication <i>Recommendation ITU-T H.264: Advanced video coding for generic audiovisual services</i>.</p>

    Args:
        name: <p>The name of the preset. We recommend that the name be unique within the AWS account, but uniqueness is not enforced.</p>
        description: <p>A description of the preset.</p>
        container: <p>The container type for the output file. Valid values include <code>flac</code>, <code>flv</code>, <code>fmp4</code>, <code>gif</code>, <code>mp3</code>, <code>mp4</code>, <code>mpg</code>, <code>mxf</code>, <code>oga</code>, <code>ogg</code>, <code>ts</code>, and <code>webm</code>.</p>
        video: <p>A section of the request body that specifies the video parameters.</p>
        audio: <p>A section of the request body that specifies the audio parameters.</p>
        thumbnails: <p>A section of the request body that specifies the thumbnail parameters, if any.</p>

    Raises:
        capo_elastic_transcoder.errors.access_denied_exception.AccessDeniedException: <p>General authentication failure. The request was not signed correctly.</p>
        capo_elastic_transcoder.errors.incompatible_version_exception.IncompatibleVersionException
        capo_elastic_transcoder.errors.internal_service_exception.InternalServiceException: <p>Elastic Transcoder encountered an unexpected exception while trying to fulfill the request.</p>
        capo_elastic_transcoder.errors.limit_exceeded_exception.LimitExceededException: <p>Too many operations for a given AWS account. For example, the number of pipelines exceeds the maximum allowed.</p>
        capo_elastic_transcoder.errors.validation_exception.ValidationException: <p>One or more required parameter values were not provided in the request.</p>
        capo_elastic_transcoder.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_elastic_transcoder.types.create_preset_request.CreatePresetRequest]",
    ) -> OperationResponse[
        "capo_elastic_transcoder.types.create_preset_response.CreatePresetResponse"
    ]:
        import capo_elastic_transcoder._operations.ets_customer_service.create_preset

        output, http_response = (
            capo_elastic_transcoder._operations.ets_customer_service.create_preset.create_preset(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreatePreset")
    )
    input_: capo_elastic_transcoder.types.create_preset_request.CreatePresetRequest = {
        "name": name,
        "container": container,
    }
    if description is not None:
        input_["description"] = description
    if video is not None:
        input_["video"] = video
    if audio is not None:
        input_["audio"] = audio
    if thumbnails is not None:
        input_["thumbnails"] = thumbnails

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output