Skip to content

Commit

Permalink
Add SVT-AV1 Film Grain Synthesis
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Oct 1, 2022
1 parent 9827241 commit c057804
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
13 changes: 10 additions & 3 deletions NotEnoughAV1Encodes/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
<GroupBox Header="{lex:Loc TabItemVideo}" HorizontalAlignment="Left" Margin="10,10,0,0" Width="385" Height="210" VerticalAlignment="Top" mah:ControlsHelper.ContentCharacterCasing="Normal">
<Grid Background="{Binding ElementName=ListBoxAudioTracks, Path=Background, UpdateSourceTrigger=PropertyChanged}">
<Label Content="{lex:Loc LabelEncoder}" HorizontalAlignment="Left" Margin="19,15,0,0" VerticalAlignment="Top" Width="111" />
<ComboBox x:Name="ComboBoxVideoEncoder" HorizontalAlignment="Left" Margin="135,14,0,0" VerticalAlignment="Top" Width="140" Height="28" VerticalContentAlignment="Center" SelectedIndex="{Binding Encoder}" SelectionChanged="ComboBoxVideoEncoder_SelectionChanged">
<ComboBox x:Name="ComboBoxVideoEncoder" SelectedIndex="{Binding Encoder}" HorizontalAlignment="Left" Margin="135,14,0,0" VerticalAlignment="Top" Width="140" Height="28" VerticalContentAlignment="Center" SelectionChanged="ComboBoxVideoEncoder_SelectionChanged">
<ComboBoxItem Content="aom (AV1 FFmpeg)" IsSelected="True" />
<ComboBoxItem Content="rav1e (AV1 FFmpeg)" />
<ComboBoxItem Content="svt-av1 (AV1 FFmpeg)" />
Expand Down Expand Up @@ -587,9 +587,16 @@
<ComboBoxItem Content="6" />
</ComboBox>
<Label x:Name="LabelSVTAV1MaxGOP" Content="Max GOP Size:" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="56" Canvas.Top="85" />
<TextBox x:Name="TextBoxSVTAV1MaxGOP" HorizontalAlignment="Left" Height="29" TextWrapping="Wrap" Text="{Binding SvtAv1KeyInt}" VerticalAlignment="Top" Width="90" Canvas.Left="184" Canvas.Top="85" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<TextBox x:Name="TextBoxSVTAV1MaxGOP" HorizontalAlignment="Left" Height="29" TextWrapping="Wrap" Text="{Binding SvtAv1KeyInt}" ToolTip="GOP size (frames)" VerticalAlignment="Top" Width="90" Canvas.Left="184" Canvas.Top="85" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<Label x:Name="LabelSVTAV1Lookahead" Content="Lookahead:" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="56" Canvas.Top="119" />
<TextBox x:Name="TextBoxSVTAV1Lookahead" HorizontalAlignment="Left" Height="29" TextWrapping="Wrap" Text="{Binding SvtAv1Lookahead}" VerticalAlignment="Top" Width="90" Canvas.Left="184" Canvas.Top="119" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<TextBox x:Name="TextBoxSVTAV1Lookahead" HorizontalAlignment="Left" Height="29" TextWrapping="Wrap" Text="{Binding SvtAv1Lookahead}" ToolTip="Number of frames in the future to look ahead, beyond minigop, temporal filtering, and rate control" VerticalAlignment="Top" Width="90" Canvas.Left="184" Canvas.Top="119" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<Label x:Name="LabelSVTAV1FilmGrain" Content="Film Grain:" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="337" Canvas.Top="17" Width="107" />
<TextBox x:Name="TextBoxSVTAV1FilmGrain" HorizontalAlignment="Left" Height="29" Text="{Binding SvtAv1FilmGrain}" ToolTip="Enable film grain [0: off, 1-50: level of denoising for film grain]" PreviewTextInput="NumberValidationTextBox" VerticalAlignment="Top" Width="90" Canvas.Left="468" Canvas.Top="17" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<Label x:Name="LabelSVTAV1FilmGrainDenoise" Content="Film Grain Denoise:" Canvas.Left="337" Canvas.Top="51" Width="128" HorizontalAlignment="Left" VerticalAlignment="Center" />
<ComboBox x:Name="TextBoxSVTAV1FilmGrainDenoise" SelectedIndex="{Binding SvtAv1FilmGrainDenoise}" ToolTip="Apply denoising when film grain is ON, default is 1 [0: no denoising, film grain data sent in frame header, 1: level of denoising is set by the film-grain parameter]" HorizontalAlignment="Center" VerticalAlignment="Top" Width="90" Canvas.Left="468" Canvas.Top="51" Height="29" VerticalContentAlignment="Center" RenderTransformOrigin="0.722,0.448">
<ComboBoxItem Content="0" />
<ComboBoxItem Content="1" />
</ComboBox>
</Canvas>
<Canvas HorizontalAlignment="Left" Height="237" VerticalAlignment="Top" Width="1025" Margin="5,6,0,0">
<Canvas.Style>
Expand Down
11 changes: 8 additions & 3 deletions NotEnoughAV1Encodes/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ private string GenerateAomFFmpegCommand()
}

settings += " -aom-params " +
" tune-content=" + ComboBoxAomencTuneContent.Text + // Tune-Content
"tune-content=" + ComboBoxAomencTuneContent.Text + // Tune-Content
":sharpness=" + ComboBoxAomencSharpness.Text + // Sharpness (Filter)
":enable-keyframe-filtering=" + ComboBoxAomencKeyFiltering.SelectedIndex; // Key Frame Filtering

Expand Down Expand Up @@ -1494,7 +1494,10 @@ private string GenerateSvtAV1FFmpegCommand()
settings += " -tile_columns " + ComboBoxSVTAV1TileColumns.Text + // Tile Columns
" -tile_rows " + ComboBoxSVTAV1TileRows.Text + // Tile Rows
" -g " + TextBoxSVTAV1MaxGOP.Text + // Keyframe Interval
" -la_depth " + TextBoxSVTAV1Lookahead.Text; // Lookahead
" -la_depth " + TextBoxSVTAV1Lookahead.Text + // Lookahead
" -svtav1-params " +
"film-grain=" + TextBoxSVTAV1FilmGrain.Text + // Film Grain
":film-grain-denoise=" + TextBoxSVTAV1FilmGrainDenoise.Text; // Film Grain Denoise
}

return settings;
Expand Down Expand Up @@ -1676,7 +1679,9 @@ private string GenerateSvtAV1Command()
settings += " --tile-columns " + ComboBoxSVTAV1TileColumns.Text + // Tile Columns
" --tile-rows " + ComboBoxSVTAV1TileRows.Text + // Tile Rows
" --keyint " + TextBoxSVTAV1MaxGOP.Text + // Keyframe Interval
" --lookahead " + TextBoxSVTAV1Lookahead.Text; // Lookahead
" --lookahead " + TextBoxSVTAV1Lookahead.Text + // Lookahead
" --film-grain " + TextBoxSVTAV1FilmGrain.Text + // Film Grain
" --film-grain-denoise " + TextBoxSVTAV1FilmGrainDenoise.Text; // Film Grain Denoise
}

return settings;
Expand Down
9 changes: 9 additions & 0 deletions NotEnoughAV1Encodes/Video/VideoSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,19 @@ public class VideoSettings
public int Rav1eTune { get; set; }

// Advanced SVT-AV1 Settings

/// <summary>Number of tile columns to use, TileCol == log2(x), default changes per resolution</summary>
public int SvtAv1TileColumns { get; set; }
/// <summary>Number of tile rows to use, TileRow == log2(x), default changes per resolution</summary>
public int SvtAv1TileRows { get; set; }
/// <summary>GOP size (frames), use s suffix for seconds (SvtAv1EncApp only) [-2: ~5 seconds, -1: "infinite" only for CRF, 0: == -1]</summary>
public string SvtAv1KeyInt { get; set; } = "-1";
/// <summary>Number of frames in the future to look ahead, beyond minigop, temporal filtering, and rate control [-1: auto]</summary>
public string SvtAv1Lookahead { get; set; } = "33";
/// <summary>Enable film grain [0: off, 1-50: level of denoising for film grain]</summary>
public int SvtAv1FilmGrain { get; set; } = 0;
/// <summary>Apply denoising when film grain is ON, default is 1 [0: no denoising, film grain data sent in frame header, 1: level of denoising is set by the film-grain parameter]</summary>
public int SvtAv1FilmGrainDenoise { get; set; } = 1;

// Advanced VPX-VP9 Settings
public int Vp9Threads { get; set; } = 5;
Expand Down

0 comments on commit c057804

Please sign in to comment.