From b0a0845103345334ca53c92d0794cfb7a96b55e7 Mon Sep 17 00:00:00 2001 From: alkl58 Date: Mon, 18 Sep 2023 17:43:26 +0200 Subject: [PATCH] Crop before Resize #146 --- NotEnoughAV1Encodes/MainWindow.xaml.cs | 27 +++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/NotEnoughAV1Encodes/MainWindow.xaml.cs b/NotEnoughAV1Encodes/MainWindow.xaml.cs index 02708ce..ff84f36 100644 --- a/NotEnoughAV1Encodes/MainWindow.xaml.cs +++ b/NotEnoughAV1Encodes/MainWindow.xaml.cs @@ -1933,40 +1933,39 @@ private string GenerateVideoFilters() bool resize = ToggleSwitchFilterResize.IsOn; bool deinterlace = ToggleSwitchFilterDeinterlace.IsOn; bool fps = ComboBoxVideoFrameRate.SelectedIndex != 0; - bool _oneFilter = false; + bool oneFilter = false; string FilterCommand = ""; if (crop || rotate || resize || deinterlace || fps) { FilterCommand = " -vf "; - if (resize) - { - // Has to be last, due to scaling algorithm - FilterCommand += VideoFiltersResize(); - _oneFilter = true; - } if (crop) { - if (_oneFilter) { FilterCommand += ","; } FilterCommand += VideoFiltersCrop(); - _oneFilter = true; + oneFilter = true; + } + if (resize) + { + if (oneFilter) { FilterCommand += ","; } + FilterCommand += VideoFiltersResize(); + oneFilter = true; } if (rotate) { - if (_oneFilter) { FilterCommand += ","; } + if (oneFilter) { FilterCommand += ","; } FilterCommand += VideoFiltersRotate(); - _oneFilter = true; + oneFilter = true; } if (deinterlace) { - if (_oneFilter) { FilterCommand += ","; } + if (oneFilter) { FilterCommand += ","; } FilterCommand += VideoFiltersDeinterlace(); - _oneFilter = true; + oneFilter = true; } if (fps) { - if (_oneFilter) { FilterCommand += ","; } + if (oneFilter) { FilterCommand += ","; } FilterCommand += GenerateFFmpegFramerate(); } }