Exemple #1
0
def _create_mp4_muxing(encoding, output, output_path, streams, file_name):
    # type: (Encoding, Output, str, list[Stream], str) -> Mp4Muxing
    """
    Creates a fragmented MP4 muxing. This will generate segments with a given segment length for
    adaptive streaming.

    <p>API endpoint:
    https://bitmovin.com/docs/encoding/api-reference/all#/Encoding/PostEncodingEncodingsMuxingsFmp4ByEncodingId

    :param encoding: The encoding where to add the muxing to
    :param output: The output that should be used for the muxing to write the segments to
    :param output_path: The output path where the fragmented segments will be written to
    :param streams: The stream that is associated with the muxing
    :param file_name: The name of the file that will be written to the output
    """

    muxing = Mp4Muxing(outputs=[
        _build_encoding_output(output=output, output_path=output_path)
    ],
                       filename=file_name)

    for stream in streams:
        muxing_stream = MuxingStream(stream_id=stream.id)
        muxing.streams.append(muxing_stream)

    return bitmovin_api.encoding.encodings.muxings.mp4.create(
        encoding_id=encoding.id, mp4_muxing=muxing)
def _create_mp4_muxing(encoding, output, output_path, filename, fragment_duration, stream):
    # type: (Encoding, Output, str, str, Stream) -> Mp4Muxing
    """
    Creates an MP4 muxing.

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

    :param encoding: The encoding to add the MP4 muxing to
    :param output: The output that should be used for the muxing to write the segments to
    :param output_path: The output path where the fragments will be written to
    :param filename: The filename for the MP4 file
    :param stream: The stream to be added to the muxing
    """

    muxing = Mp4Muxing(
        filename=filename,
        outputs=[Utils.build_encoding_output(output_id=output.id,
                                             asset_name=Config.ASSET_NAME,
                                             output_path=output_path)],
        streams=[MuxingStream(stream_id=stream.id)],
        fragment_duration=fragment_duration,
        fragmented_mp4_muxing_manifest_type=FragmentedMp4MuxingManifestType.DASH_ON_DEMAND
    )

    return encoding_api.encodings.muxings.mp4.create(encoding_id=encoding.id, mp4_muxing=muxing)
def _create_mp4_muxing(encoding, output, output_path, streams, file_name):
    # type: (Encoding, Output, str, list, str) -> Mp4Muxing
    """
    Creates an MP4 muxing.

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

    :param encoding: The encoding to add the MP4 muxing to
    :param output: The output that should be used for the muxing to write the segments to
    :param output_path: The output path where the fragments will be written to
    :param streams: A list of streams to be added to the muxing
    :param file_name: The name of the file that will be written to the output
    """

    muxing = Mp4Muxing(
        filename=file_name,
        outputs=[
            _build_encoding_output(output=output, output_path=output_path)
        ],
        streams=[MuxingStream(stream_id=stream.id) for stream in streams])

    return bitmovin_api.encoding.encodings.muxings.mp4.create(
        encoding_id=encoding.id, mp4_muxing=muxing)