Skip to content

Commit

Permalink
Crop before Resize #146
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Sep 18, 2023
1 parent bc4131c commit b0a0845
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions NotEnoughAV1Encodes/MainWindow.xaml.cs
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit b0a0845

Please sign in to comment.