/// <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));
        }
        /// <summary>
        /// Creates a stream which binds an input file to a codec configuration.
        /// The stream is used for muxings later on.<para />
        ///
        /// API endpoint:
        /// https://bitmovin.com/docs/encoding/api-reference/sections/encodings#/Encoding/PostEncodingEncodingsStreamsByEncodingId
        /// </summary>
        /// <param name="encoding">The encoding to add the stream onto</param>
        /// <param name="input">The input that should be used</param>
        /// <param name="inputPath">The path to the input file</param>
        /// <param name="configuration">The codec configuration to be applied to the stream</param>
        /// <param name="streamSelectionMode">The path to the input file</param>
        /// <param name="position">The codec configuration to be applied to the stream</param>
        private Task <Stream> CreateStream(Models.Encoding encoding, Input input, string inputPath,
                                           CodecConfiguration configuration, StreamSelectionMode streamSelectionMode, int position)
        {
            var streamInput = new StreamInput()
            {
                InputId       = input.Id,
                InputPath     = inputPath,
                SelectionMode = streamSelectionMode,
                Position      = position
            };

            var stream = new Stream()
            {
                InputStreams = new List <StreamInput>()
                {
                    streamInput
                },
                CodecConfigId = configuration.Id,
                Mode          = StreamMode.STANDARD
            };

            return(_bitmovinApi.Encoding.Encodings.Streams.CreateAsync(encoding.Id, stream));
        }