From 946b6fc3f4b87f784c0d30581ffd72f0c2c4ce11 Mon Sep 17 00:00:00 2001 From: Tichau Date: Tue, 19 Apr 2016 08:44:55 +0200 Subject: [PATCH] Fixed: Video Scaling doesn't work with specific video size. Fixed: Issue where video can't be compressed using H.264 codec (mp4 or mkv presets) when its size (width or height) is not divisible by 2 (append a lot when the user try to scale a video) (github issue #2). --- .../ConversionJobs/ConversionJob_FFMPEG.Converters.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs index fcc6674..a2baece 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.Converters.cs @@ -23,7 +23,13 @@ namespace FileConverter.ConversionJobs { float scaleFactor = conversionPreset.GetSettingsValue(ConversionPreset.ConversionSettingKeys.VideoScale); string scaleArgs = string.Empty; - if (Math.Abs(scaleFactor - 1f) >= 0.005f) + + if (conversionPreset.OutputType == OutputType.Mkv || conversionPreset.OutputType == OutputType.Mp4) + { + // This presets use h264 codec, the size of the video need to be divisible by 2. + scaleArgs = string.Format("scale=trunc(iw*{0}/2)*2:trunc(ih*{0}/2)*2", scaleFactor.ToString("#.##", CultureInfo.InvariantCulture)); + } + else if (Math.Abs(scaleFactor - 1f) >= 0.005f) { scaleArgs = string.Format("scale=iw*{0}:ih*{0}", scaleFactor.ToString("#.##", CultureInfo.InvariantCulture)); }