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).
This commit is contained in:
Tichau committed 2016-04-19 08:44:55 +02:00
1 parent e0beb08a09
commit 946b6fc3f4
1 file changed
+7 -1
@@ -23,7 +23,13 @@ namespace FileConverter.ConversionJobs
{
float scaleFactor = conversionPreset.GetSettingsValue<float>(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));
}