/// <summary> /// Creates an HLS video playlist<para /> /// /// API endpoint: /// https://bitmovin.com/docs/encoding/api-reference/sections/manifests#/Encoding/PostEncodingManifestsHlsStreamsByManifestId /// </summary> /// <param name="encoding">The encoding to which the manifest belongs to</param> /// <param name="hlsManifest">The manifest to which the playlist should be added</param> /// <param name="filename">The filename to be used for the playlist file</param> /// <param name="videoMuxing">The video muxing for which the playlist should be generated</param> /// <param name="segmentPath">The path containing the video segments to be referenced</param> /// <param name="audioMediaInfo">The audio media playlist containing the associated audio group id</param> private Task <StreamInfo> CreateVideoStreamPlaylist(Models.Encoding encoding, HlsManifest hlsManifest, string filename, Fmp4Muxing videoMuxing, string segmentPath, AudioMediaInfo audioMediaInfo) { var streamInfo = new StreamInfo() { Uri = filename, EncodingId = encoding.Id, StreamId = videoMuxing.Streams.ElementAt(0).StreamId, MuxingId = videoMuxing.Id, Audio = audioMediaInfo.GroupId, SegmentPath = segmentPath }; return(_bitmovinApi.Encoding.Manifests.Hls.Streams.CreateAsync(hlsManifest.Id, streamInfo)); }
/// <summary> /// Creates a fragmented MP4 muxing. This will split the output into continuously numbered segments /// of a given length for adaptive streaming. However, the unencrypted segments will not be written /// to a permanent storage as there's no output defined for the muxing. Instead, an output needs to /// be defined for the DRM configuration resource which will later be added to this muxing.<para/> /// /// API endpoint: /// https://bitmovin.com/docs/encoding/api-reference/all#/Encoding/PostEncodingEncodingsMuxingsFmp4ByEncodingId /// </summary> /// <param name="encoding">The encoding to which the muxing will be added</param> /// <param name="stream">The stream to be muxed</param> private Task <Fmp4Muxing> CreateFmp4Muxing(Models.Encoding encoding, Stream stream) { var muxingStream = new MuxingStream() { StreamId = stream.Id }; var muxing = new Fmp4Muxing() { SegmentLength = 4, Streams = new List <MuxingStream>() { muxingStream } }; return(_bitmovinApi.Encoding.Encodings.Muxings.Fmp4.CreateAsync(encoding.Id, muxing)); }
/// <summary> /// Creates an HLS audio media playlist<para /> /// /// API endpoint: /// https://bitmovin.com/docs/encoding/api-reference/sections/manifests#/Encoding/PostEncodingManifestsHlsMediaAudioByManifestId /// </summary> /// <param name="encoding">The encoding to which the manifest belongs to</param> /// <param name="hlsManifest">The manifest to which the playlist should be added</param> /// <param name="audioMuxing">The audio muxing for which the playlist should be generated</param> /// <param name="segmentPath">The path containing the audio segments to be referenced by the playlist</param> private Task <AudioMediaInfo> CreateAudioMediaPlaylist(Models.Encoding encoding, HlsManifest hlsManifest, Fmp4Muxing audioMuxing, string segmentPath) { var audioMediaInfo = new AudioMediaInfo() { Name = "audio.m3u8", Uri = "audio.m3u8", GroupId = "audio", EncodingId = encoding.Id, StreamId = audioMuxing.Streams[0].StreamId, MuxingId = audioMuxing.Id, Language = "en", AssocLanguage = "en", Autoselect = false, IsDefault = false, Forced = false, SegmentPath = segmentPath }; return(_bitmovinApi.Encoding.Manifests.Hls.Media.Audio.CreateAsync(hlsManifest.Id, audioMediaInfo)); }
/// <summary> /// Creates a fragmented MP4 muxing. This will generate segments with a given segment length for /// adaptive streaming.<para /> /// /// API endpoint: /// https://bitmovin.com/docs/encoding/api-reference/all#/Encoding/PostEncodingEncodingsMuxingsFmp4ByEncodingId /// </summary> /// <param name="encoding">The encoding where to add the muxing to</param> /// <param name="output">The output that should be used for the muxing to write the segments to</param> /// <param name="outputPath">The output path where the fragmented segments will be written to</param> /// <param name="stream">The stream to be muxed</param> private Task <Fmp4Muxing> CreateFmp4Muxing(Models.Encoding encoding, Output output, string outputPath, Stream stream) { var muxingStream = new MuxingStream() { StreamId = stream.Id }; var muxing = new Fmp4Muxing() { SegmentLength = 4, Outputs = new List <EncodingOutput>() { BuildEncodingOutput(output, outputPath) }, Streams = new List <MuxingStream>() { muxingStream } }; return(_bitmovinApi.Encoding.Encodings.Muxings.Fmp4.CreateAsync(encoding.Id, muxing)); }