Ejemplo n.º 1
0
        private void GenerateAviSynthScript(Size resizeTo)
        {
            SubtitleInfo sub            = _jobInfo.SubtitleStreams.FirstOrDefault(item => item.HardSubIntoVideo);
            string       subFile        = string.Empty;
            bool         keepOnlyForced = false;

            if (sub != null)
            {
                subFile        = sub.TempFile;
                keepOnlyForced = sub.KeepOnlyForcedCaptions;
            }
            _jobInfo.AviSynthScript = AviSynthGenerator.Generate(_jobInfo.VideoStream,
                                                                 false,
                                                                 0f,
                                                                 resizeTo,
                                                                 _jobInfo.EncodingProfile.StereoType,
                                                                 _jobInfo.StereoVideoStream,
                                                                 false,
                                                                 subFile,
                                                                 keepOnlyForced,
                                                                 AppSettings.Use64BitEncoders && AppSettings.UseFfmpegScaling);
            if (!string.IsNullOrEmpty(AviSynthGenerator.StereoConfigFile))
            {
                _jobInfo.AviSynthStereoConfig = AviSynthGenerator.StereoConfigFile;
            }
        }
Ejemplo n.º 2
0
        private string GenerateAviSynthFile()
        {
            int targetHeight;

            float sourceFPS = (float)Math.Round(_jobInfo.VideoStream.FPS, 3);
            float targetFPS = 0f;
            bool  changeFPS = false;

            int targetWidth = _jobInfo.VideoStream.AspectRatio >= 1.4f ? 1024 : 720;

            if (_jobInfo.Input == InputType.InputDvd)
            {
                _jobInfo.VideoStream.Width =
                    (int)Math.Round(_jobInfo.VideoStream.Height * _jobInfo.VideoStream.AspectRatio, 0);
            }

            if (_jobInfo.EncodingProfile.OutFormat == OutputType.OutputDvd)
            {
                if (_jobInfo.EncodingProfile.SystemType == 0)
                {
                    targetHeight = 576;
                    if (Math.Abs(sourceFPS - 25f) > 0)
                    {
                        changeFPS = true;
                    }
                    targetFPS = 25f;
                }
                else
                {
                    targetHeight = 480;
                    if (Math.Abs(sourceFPS - 29.970f) > 0 && Math.Abs(sourceFPS - 23.976f) > 0)
                    {
                        changeFPS = true;
                    }
                    targetFPS = (float)Math.Round(30000f / 1001f, 3);
                }
            }
            else
            {
                targetWidth  = _jobInfo.EncodingProfile.TargetWidth;
                targetHeight = (int)Math.Floor(targetWidth / _jobInfo.VideoStream.AspectRatio);
            }

            Size resizeTo = new Size(targetWidth, targetHeight);

            SubtitleInfo sub            = _jobInfo.SubtitleStreams.FirstOrDefault(item => item.HardSubIntoVideo);
            string       subFile        = string.Empty;
            bool         keepOnlyForced = false;

            if (sub != null)
            {
                subFile        = sub.TempFile;
                keepOnlyForced = sub.KeepOnlyForcedCaptions;
            }

            return(AviSynthGenerator.Generate(_jobInfo.VideoStream, changeFPS, targetFPS, resizeTo, StereoEncoding.None,
                                              new StereoVideoInfo(), true, subFile, keepOnlyForced, false));
        }