Skip to content

Commit 7228b8b

Browse files
committed
Easier UI and explicit commandline args for picking video and audio codecs for ffmpeg
1 parent 90a9a37 commit 7228b8b

File tree

5 files changed

+284
-217
lines changed

5 files changed

+284
-217
lines changed

LibSidWiz/Outputs/FfmpegOutput.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,25 @@ public class FfmpegOutput : IGraphicsOutput
1111
private readonly Process _process;
1212
private readonly BinaryWriter _writer;
1313

14-
public FfmpegOutput(string pathToExe, string filename, int width, int height, int fps, string extraArgs, string masterAudioFilename)
14+
public FfmpegOutput(string pathToExe, string filename, int width, int height, int fps, string extraArgs, string masterAudioFilename, string videoCodec, string audioCodec)
1515
{
1616
// Build the FFMPEG commandline
1717
var arguments = "-y -hide_banner"; // Overwrite, don't show banner at startup
1818

19-
// Audio part
19+
// Audio input
2020
if (File.Exists(masterAudioFilename))
2121
{
2222
arguments += $" -i \"{masterAudioFilename}\"";
2323
}
2424

25-
// Video part
26-
arguments += $" -f rawvideo -pixel_format bgr0 -video_size {width}x{height} -framerate {fps} -i pipe: -movflags +faststart";
25+
// Video input
26+
arguments += $" -f rawvideo -pixel_format bgr0 -video_size {width}x{height} -framerate {fps} -i pipe:";
27+
28+
// Audio output
29+
arguments += $" -codec:a {audioCodec}";
30+
31+
// Video output
32+
arguments += $" -codec:v {videoCodec} -movflags +faststart";
2733

2834
// Extra args
2935
arguments += $" {extraArgs} \"{filename}\"";

SidWiz/SidWizPlusGUI.Designer.cs

Lines changed: 101 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SidWiz/SidWizPlusGUI.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private class Settings
9595
public Color BackgroundColor { get; set; } = Color.Black;
9696
public string BackgroundImageFilename { get; set; }
9797
public PreviewSettings Preview { get; } = new() {Enabled = true, Frameskip = 1};
98-
public EncodeSettings EncodeVideo { get; } = new() {Enabled = false};
98+
public EncodeSettings EncodeVideo { get; } = new() {Enabled = false, VideoCodec = "h264", AudioCodec = "aac"};
9999
public int RenderThreads { get; set; } = Environment.ProcessorCount;
100100

101101
public MasterAudioSettings MasterAudio { get; } = new() {IsAutomatic = true, ApplyReplayGain = true};
@@ -110,6 +110,8 @@ public class MasterAudioSettings
110110
public class EncodeSettings
111111
{
112112
public bool Enabled { get; set; }
113+
public string VideoCodec { get; set; }
114+
public string AudioCodec { get; set; }
113115
}
114116

115117
public class PreviewSettings
@@ -138,6 +140,8 @@ public void FromControls(SidWizPlusGui form)
138140
Preview.Enabled = form.PreviewCheckBox.Checked;
139141
Preview.Frameskip = (int) form.PreviewFrameskip.Value;
140142
EncodeVideo.Enabled = form.EncodeCheckBox.Checked;
143+
EncodeVideo.VideoCodec = form.VideoCodec.Text;
144+
EncodeVideo.AudioCodec = form.AudioCodec.Text;
141145
MasterAudio.IsAutomatic = form.AutogenerateMasterMix.Checked;
142146
MasterAudio.ApplyReplayGain = form.MasterMixReplayGain.Checked;
143147
MasterAudio.Path = form.MasterAudioPath.Text;
@@ -161,6 +165,8 @@ public void ToControls(SidWizPlusGui form)
161165
form.PreviewCheckBox.Checked = Preview.Enabled;
162166
form.PreviewFrameskip.Value = Preview.Frameskip;
163167
form.EncodeCheckBox.Checked = EncodeVideo.Enabled;
168+
form.VideoCodec.Text = EncodeVideo.VideoCodec;
169+
form.AudioCodec.Text = EncodeVideo.AudioCodec;
164170
form.AutogenerateMasterMix.Checked = MasterAudio.IsAutomatic;
165171
form.MasterMixReplayGain.Checked = MasterAudio.ApplyReplayGain;
166172
form.MasterAudioPath.Text = MasterAudio.Path;
@@ -809,7 +815,9 @@ private void RenderButton_Click(object sender, EventArgs e)
809815
_settings.Height,
810816
_settings.FrameRate,
811817
_programSettings.FfmpegExtraParameters,
812-
_settings.MasterAudio.Path));
818+
_settings.MasterAudio.Path,
819+
_settings.EncodeVideo.VideoCodec,
820+
_settings.EncodeVideo.AudioCodec));
813821
}
814822
}
815823

0 commit comments

Comments
 (0)