Example #1
0
def _create_video_media_playlist(encoding, manifest, video_muxing,
                                 video_stream, uri, segment_path, audio_group):
    # type: (Encoding, HlsManifest, Muxing, Stream, str, str, str) -> None
    """
    Creates an HLS video playlist

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

    :param encoding: the encoding where the resources belong to
    :param manifest: the master manifest where the video stream playlist should belong to
    :param video_muxing: the muxing that should be used
    :param video_stream: the stream of the muxing
    :param uri: the relative uri of the playlist file that will be generated
    :param segment_path: the path pointing to the respective video segments
    """

    stream_info = StreamInfo(uri=uri,
                             encoding_id=encoding.id,
                             stream_id=video_stream.id,
                             muxing_id=video_muxing.id,
                             audio=audio_group,
                             segment_path=segment_path)

    bitmovin_api.encoding.manifests.hls.streams.create(manifest_id=manifest.id,
                                                       stream_info=stream_info)
def _add_hls_video_stream_info(manifest, encoding_id, muxing_id, stream_id,
                               relative_path, segment_path):
    stream_info = StreamInfo(
        name="Stream Info for muxing {}".format(muxing_id),
        audio='audio',
        closed_captions='NONE',
        segment_path=segment_path,
        uri='{}video.m3u8'.format(relative_path),
        encoding_id=encoding_id,
        stream_id=stream_id,
        muxing_id=muxing_id)

    return manifest_api.hls.streams.create(manifest_id=manifest.id,
                                           stream_info=stream_info)
Example #3
0
def _create_video_stream_playlist(encoding, manifest, bitrate, muxing,
                                  segment_path, audio_media_info):
    # type: (Encoding, HlsManifest, int, Muxing, str, AudioMediaInfo) -> StreamInfo
    """
    Creates an HLS video playlist

    :param encoding: The encoding to which the manifest belongs to
    :param manifest: The manifest to which the playlist should be added
    :param bitrate: The bitrate of the video configuration
    :param muxing: The video muxing for which the playlist should be generated
    :param segment_path: The path containing the video segments to be referenced
    :param audio_media_info: The audio media playlist containing the associated audio group id
    """
    stream_info = StreamInfo(uri="video_{0}kbps.m3u8".format(bitrate / 1000),
                             encoding_id=encoding.id,
                             stream_id=muxing.streams[0].stream_id,
                             muxing_id=muxing.id,
                             audio=audio_media_info.group_id,
                             segment_path=segment_path)

    return bitmovin_api.encoding.manifests.hls.streams.create(
        manifest_id=manifest.id, stream_info=stream_info)