Skip to content

Commit

Permalink
Add per-encode FFMPEG parameters and distinguish the global settings
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-zhao committed Jul 3, 2024
1 parent b77a6e4 commit 13797f0
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 164 deletions.
32 changes: 28 additions & 4 deletions SidWiz/SidWizPlusGUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions SidWiz/SidWizPlusGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class ProgramSettings
[Description("Path to FFMPEG. Download from https://ffmpeg.org/download.html")]
public string FfmpegPath { get; set; }
[Category("FFMPEG")]
[DisplayName("Extra Parameters")]
[Description("Extra parameters for FFMPEG. These are inserted just before the output filename; you can use this to select a non-default codec, for example.")]
[DisplayName("Global Extra Parameters")]
[Description("Extra parameters for FFMPEG. These are stored in your user settings, and will apply to all encodes. Per-encode settings can be entered on the Video tab.")]
public string FfmpegExtraParameters { get; set; }

[Category("MultiDumper")]
Expand Down Expand Up @@ -96,7 +96,7 @@ private class Settings
public Color BackgroundColor { get; set; } = Color.Black;
public string BackgroundImageFilename { get; set; }
public PreviewSettings Preview { get; } = new() {Enabled = true, Frameskip = 1};
public EncodeSettings EncodeVideo { get; } = new() {Enabled = false, VideoCodec = "libx264", AudioCodec = "aac"};
public EncodeSettings EncodeVideo { get; } = new() {Enabled = false, VideoCodec = "libx264", AudioCodec = "aac", ExtraParameters = ""};
public int RenderThreads { get; set; } = Environment.ProcessorCount;

public MasterAudioSettings MasterAudio { get; } = new() {IsAutomatic = true, ApplyReplayGain = true};
Expand All @@ -113,6 +113,7 @@ public class EncodeSettings
public bool Enabled { get; set; }
public string VideoCodec { get; set; }
public string AudioCodec { get; set; }
public string ExtraParameters { get; set; }
}

public class PreviewSettings
Expand Down Expand Up @@ -143,6 +144,7 @@ public void FromControls(SidWizPlusGui form)
EncodeVideo.Enabled = form.EncodeCheckBox.Checked;
EncodeVideo.VideoCodec = form.VideoCodec.Text.Split([' '], 2).FirstOrDefault() ?? "libx264";
EncodeVideo.AudioCodec = form.AudioCodec.Text.Split([' '], 2).FirstOrDefault() ?? "aac";
EncodeVideo.ExtraParameters = form.ExtraFFMPEGParameters.Text;
MasterAudio.IsAutomatic = form.AutogenerateMasterMix.Checked;
MasterAudio.ApplyReplayGain = form.MasterMixReplayGain.Checked;
MasterAudio.Path = form.MasterAudioPath.Text;
Expand All @@ -168,6 +170,7 @@ public void ToControls(SidWizPlusGui form)
form.EncodeCheckBox.Checked = EncodeVideo.Enabled;
form.VideoCodec.Text = EncodeVideo.VideoCodec;
form.AudioCodec.Text = EncodeVideo.AudioCodec;
form.ExtraFFMPEGParameters.Text = EncodeVideo.ExtraParameters;
form.AutogenerateMasterMix.Checked = MasterAudio.IsAutomatic;
form.MasterMixReplayGain.Checked = MasterAudio.ApplyReplayGain;
form.MasterAudioPath.Text = MasterAudio.Path;
Expand Down Expand Up @@ -822,7 +825,7 @@ private void RenderButton_Click(object sender, EventArgs e)
_settings.Width,
_settings.Height,
_settings.FrameRate,
_programSettings.FfmpegExtraParameters,
string.Join(" ", _programSettings.FfmpegExtraParameters, _settings.EncodeVideo.ExtraParameters),
_settings.MasterAudio.Path,
_settings.EncodeVideo.VideoCodec,
_settings.EncodeVideo.AudioCodec,
Expand Down
Loading

0 comments on commit 13797f0

Please sign in to comment.