Beispiel #1
0
def _create_encoding(name, description):
    # type: (str, str) -> Encoding
    """
    Creates an Encoding object. This is the base object to configure your encoding.

    API endpoint:
    https://bitmovin.com/docs/encoding/api-reference/sections/encodings#/Encoding/PostEncodingEncodings

    :param name: A name that will help you identify the encoding in our dashboard (required)
    :param description: A description of the encoding (optional)
    """

    encoding = Encoding(name=name, description=description)
    return bitmovin_api.encoding.encodings.create(encoding=encoding)
def _create_and_configure_encoding(encoding_input, input_path, codec_configs,
                                   encoding_name, output, output_path):
    # type: (Input, str, list, str, Output, str) -> Encoding
    """
    Creates an Encoding object and adds a stream and a muxing for each codec configuration to it.
    This creates a fully configured encoding.

    <p>API endpoint:
    https://bitmovin.com/docs/encoding/api-reference/sections/encodings#/Encoding/PostEncodingEncodings

    :param encoding_input The input that should be used for the encoding
    :param input_path The path to the input file which should be used for the encoding
    :param codec_configs A list of codec configurations representing the different video- and audio
      renditions to be generated
    :param encoding_name A name for the encoding
    :param output The output that should be used for the encoding
    :param output_path The path where the content will be written to
    """

    encoding = Encoding(name=encoding_name)

    encoding = bitmovin_api.encoding.encodings.create(encoding=encoding)

    for codec_config in codec_configs:
        stream = _create_stream(encoding=encoding,
                                encoding_input=encoding_input,
                                input_path=input_path,
                                codec_configuration=codec_config)

        muxing_output_path = output_path

        if isinstance(codec_config, VideoConfiguration):
            muxing_output_path += "/video/{0}".format(codec_config.height)
        elif isinstance(codec_config, AudioConfiguration):
            muxing_output_path += "/audio/{0}".format(codec_config.bitrate /
                                                      100)

        _create_fmp4_muxing(encoding=encoding,
                            stream=stream,
                            output=output,
                            output_path=muxing_output_path)

    return encoding
def _create_encoding_external_gce_infra(name, description, infra):
    # type: (str, str, InfrastructureSettings) -> Encoding
    """
    Creates an Encoding object. This is the base object to configure your encoding.

    API endpoint:
    https://bitmovin.com/docs/encoding/api-reference/sections/encodings#/Encoding/PostEncodingEncodings

    :param name: A name that will help you identify the encoding in our dashboard (required)
    :param description: A description of the encoding (optional)
    """

    encoding = Encoding(
        name=name,
        description=description,
        infrastructure=infra,
        cloud_region=CloudRegion.EXTERNAL
    )

    return bitmovin_api.encoding.encodings.create(encoding=encoding)