コード例 #1
0
        /// <summary>
        /// Gets the name of the output video codec
        /// </summary>
        /// <param name="state">The state.</param>
        /// <returns>System.String.</returns>
        protected string GetVideoDecoder(EncodingJob state)
        {
            if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }

            // Only use alternative encoders for video files.
            // When using concat with folder rips, if the mfx session fails to initialize, ffmpeg will be stuck retrying and will not exit gracefully
            // Since transcoding of folder rips is expiremental anyway, it's not worth adding additional variables such as this.
            if (state.VideoType != VideoType.VideoFile)
            {
                return(null);
            }

            if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
            {
                if (string.Equals(GetEncodingOptions().HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
                {
                    switch (state.MediaSource.VideoStream.Codec.ToLower())
                    {
                    case "avc":
                    case "h264":
                        if (MediaEncoder.SupportsDecoder("h264_qsv"))
                        {
                            // Seeing stalls and failures with decoding. Not worth it compared to encoding.
                            return("-c:v h264_qsv ");
                        }
                        break;

                    case "mpeg2video":
                        if (MediaEncoder.SupportsDecoder("mpeg2_qsv"))
                        {
                            return("-c:v mpeg2_qsv ");
                        }
                        break;

                    case "vc1":
                        if (MediaEncoder.SupportsDecoder("vc1_qsv"))
                        {
                            return("-c:v vc1_qsv ");
                        }
                        break;
                    }
                }
            }

            // leave blank so ffmpeg will decide
            return(null);
        }
コード例 #2
0
ファイル: BaseEncoder.cs プロジェクト: egandt/Emby
        /// <summary>
        /// Gets the name of the output video codec
        /// </summary>
        /// <param name="state">The state.</param>
        /// <returns>System.String.</returns>
        protected string GetVideoDecoder(EncodingJob state)
        {
            if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }

            if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
            {
                if (string.Equals(GetEncodingOptions().HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
                {
                    switch (state.MediaSource.VideoStream.Codec.ToLower())
                    {
                    case "avc":
                    case "h264":
                        if (MediaEncoder.SupportsDecoder("h264_qsv"))
                        {
                            // Seeing stalls and failures with decoding. Not worth it compared to encoding.
                            return("-c:v h264_qsv ");
                        }
                        break;

                    case "mpeg2video":
                        if (MediaEncoder.SupportsDecoder("mpeg2_qsv"))
                        {
                            return("-c:v mpeg2_qsv ");
                        }
                        break;

                    case "vc1":
                        if (MediaEncoder.SupportsDecoder("vc1_qsv"))
                        {
                            return("-c:v vc1_qsv ");
                        }
                        break;
                    }
                }
            }

            // leave blank so ffmpeg will decide
            return(null);
        }
コード例 #3
0
        /// <summary>
        /// Gets the name of the output video codec
        /// </summary>
        /// <param name="state">The state.</param>
        /// <returns>System.String.</returns>
        protected string GetVideoDecoder(EncodingJob state)
        {
            if (string.Equals(GetEncodingOptions().HardwareVideoDecoder, "qsv", StringComparison.OrdinalIgnoreCase))
            {
                if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
                {
                    switch (state.MediaSource.VideoStream.Codec.ToLower())
                    {
                    case "avc":
                    case "h264":
                        if (MediaEncoder.SupportsDecoder("h264_qsv"))
                        {
                            return("-c:v h264_qsv ");
                        }
                        break;

                    case "mpeg2video":
                        if (MediaEncoder.SupportsDecoder("mpeg2_qsv"))
                        {
                            return("-c:v mpeg2_qsv ");
                        }
                        break;

                    case "vc1":
                        if (MediaEncoder.SupportsDecoder("vc1_qsv"))
                        {
                            return("-c:v vc1_qsv ");
                        }
                        break;
                    }
                }
            }

            // leave blank so ffmpeg will decide
            return(null);
        }