mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 08:27:44 +01:00
Encoding speed option now also affects VP9, prettier ffmpeg logging
This commit is contained in:
112
Code/Forms/SettingsForm.Designer.cs
generated
112
Code/Forms/SettingsForm.Designer.cs
generated
@@ -58,6 +58,10 @@
|
||||
this.delLogsOnStartup = new System.Windows.Forms.CheckBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.tabListPage2 = new Cyotek.Windows.Forms.TabListPage();
|
||||
this.label74 = new System.Windows.Forms.Label();
|
||||
this.jpegFrames = new System.Windows.Forms.CheckBox();
|
||||
this.label63 = new System.Windows.Forms.Label();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.keepMeta = new System.Windows.Forms.CheckBox();
|
||||
this.sceneChangeFillMode = new System.Windows.Forms.ComboBox();
|
||||
this.label71 = new System.Windows.Forms.Label();
|
||||
@@ -177,10 +181,6 @@
|
||||
this.cmdDebugMode = new System.Windows.Forms.ComboBox();
|
||||
this.titleLabel = new System.Windows.Forms.Label();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.jpegFrames = new System.Windows.Forms.CheckBox();
|
||||
this.label63 = new System.Windows.Forms.Label();
|
||||
this.label74 = new System.Windows.Forms.Label();
|
||||
this.settingsTabList.SuspendLayout();
|
||||
this.generalTab.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.info1)).BeginInit();
|
||||
@@ -565,6 +565,48 @@
|
||||
this.tabListPage2.Size = new System.Drawing.Size(762, 419);
|
||||
this.tabListPage2.Text = "Interpolation";
|
||||
//
|
||||
// label74
|
||||
//
|
||||
this.label74.AutoSize = true;
|
||||
this.label74.ForeColor = System.Drawing.Color.Silver;
|
||||
this.label74.Location = new System.Drawing.Point(308, 100);
|
||||
this.label74.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||
this.label74.Name = "label74";
|
||||
this.label74.Size = new System.Drawing.Size(433, 13);
|
||||
this.label74.TabIndex = 86;
|
||||
this.label74.Text = "Makes frame extraction faster and take up less disk space with no visible quality" +
|
||||
" reduction.";
|
||||
//
|
||||
// jpegFrames
|
||||
//
|
||||
this.jpegFrames.AutoSize = true;
|
||||
this.jpegFrames.Location = new System.Drawing.Point(280, 100);
|
||||
this.jpegFrames.Name = "jpegFrames";
|
||||
this.jpegFrames.Size = new System.Drawing.Size(15, 14);
|
||||
this.jpegFrames.TabIndex = 85;
|
||||
this.jpegFrames.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label63
|
||||
//
|
||||
this.label63.AutoSize = true;
|
||||
this.label63.Location = new System.Drawing.Point(10, 100);
|
||||
this.label63.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||
this.label63.Name = "label63";
|
||||
this.label63.Size = new System.Drawing.Size(170, 13);
|
||||
this.label63.TabIndex = 84;
|
||||
this.label63.Text = "Import HQ JPEGs instead of PNGs";
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label18.Location = new System.Drawing.Point(10, 150);
|
||||
this.label18.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(153, 16);
|
||||
this.label18.TabIndex = 82;
|
||||
this.label18.Text = "Interpolation Helpers";
|
||||
//
|
||||
// keepMeta
|
||||
//
|
||||
this.keepMeta.AutoSize = true;
|
||||
@@ -1879,7 +1921,7 @@
|
||||
this.ffEncArgs.Location = new System.Drawing.Point(280, 270);
|
||||
this.ffEncArgs.MinimumSize = new System.Drawing.Size(4, 21);
|
||||
this.ffEncArgs.Name = "ffEncArgs";
|
||||
this.ffEncArgs.Size = new System.Drawing.Size(400, 21);
|
||||
this.ffEncArgs.Size = new System.Drawing.Size(400, 20);
|
||||
this.ffEncArgs.TabIndex = 85;
|
||||
//
|
||||
// label56
|
||||
@@ -1922,13 +1964,13 @@
|
||||
this.ffEncPreset.ForeColor = System.Drawing.Color.White;
|
||||
this.ffEncPreset.FormattingEnabled = true;
|
||||
this.ffEncPreset.Items.AddRange(new object[] {
|
||||
"veryfast",
|
||||
"faster",
|
||||
"fast",
|
||||
"medium",
|
||||
"slow",
|
||||
"slower",
|
||||
"veryslow"});
|
||||
"Very Fast",
|
||||
"Faster",
|
||||
"Fast",
|
||||
"Medium",
|
||||
"Slow",
|
||||
"Slower",
|
||||
"Very Slow"});
|
||||
this.ffEncPreset.Location = new System.Drawing.Point(280, 240);
|
||||
this.ffEncPreset.Name = "ffEncPreset";
|
||||
this.ffEncPreset.Size = new System.Drawing.Size(250, 21);
|
||||
@@ -1940,9 +1982,9 @@
|
||||
this.label47.Location = new System.Drawing.Point(10, 243);
|
||||
this.label47.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||
this.label47.Name = "label47";
|
||||
this.label47.Size = new System.Drawing.Size(145, 13);
|
||||
this.label47.Size = new System.Drawing.Size(174, 13);
|
||||
this.label47.TabIndex = 77;
|
||||
this.label47.Text = "H264/H265 Encoding Preset";
|
||||
this.label47.Text = "Encoding Preset (Speed vs Quality)";
|
||||
//
|
||||
// label46
|
||||
//
|
||||
@@ -2073,48 +2115,6 @@
|
||||
this.titleLabel.Size = new System.Drawing.Size(119, 40);
|
||||
this.titleLabel.TabIndex = 1;
|
||||
this.titleLabel.Text = "Settings";
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label18.Location = new System.Drawing.Point(10, 150);
|
||||
this.label18.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(153, 16);
|
||||
this.label18.TabIndex = 82;
|
||||
this.label18.Text = "Interpolation Helpers";
|
||||
//
|
||||
// jpegFrames
|
||||
//
|
||||
this.jpegFrames.AutoSize = true;
|
||||
this.jpegFrames.Location = new System.Drawing.Point(280, 100);
|
||||
this.jpegFrames.Name = "jpegFrames";
|
||||
this.jpegFrames.Size = new System.Drawing.Size(15, 14);
|
||||
this.jpegFrames.TabIndex = 85;
|
||||
this.jpegFrames.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label63
|
||||
//
|
||||
this.label63.AutoSize = true;
|
||||
this.label63.Location = new System.Drawing.Point(10, 100);
|
||||
this.label63.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||
this.label63.Name = "label63";
|
||||
this.label63.Size = new System.Drawing.Size(170, 13);
|
||||
this.label63.TabIndex = 84;
|
||||
this.label63.Text = "Import HQ JPEGs instead of PNGs";
|
||||
//
|
||||
// label74
|
||||
//
|
||||
this.label74.AutoSize = true;
|
||||
this.label74.ForeColor = System.Drawing.Color.Silver;
|
||||
this.label74.Location = new System.Drawing.Point(308, 100);
|
||||
this.label74.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||
this.label74.Name = "label74";
|
||||
this.label74.Size = new System.Drawing.Size(433, 13);
|
||||
this.label74.TabIndex = 86;
|
||||
this.label74.Text = "Makes frame extraction faster and take up less disk space with no visible quality" +
|
||||
" reduction.";
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
|
||||
@@ -70,14 +70,14 @@ namespace Flowframes
|
||||
if (string.IsNullOrWhiteSpace(loglevel))
|
||||
loglevel = defLogLevel;
|
||||
|
||||
string beforeArgs = $"-hide_banner -loglevel {loglevel} -y -stats";
|
||||
string beforeArgs = $"-hide_banner -stats -loglevel {loglevel} -y";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(workingDir))
|
||||
ffmpeg.StartInfo.Arguments = $"{GetCmdArg()} cd /D {workingDir.Wrap()} & {Path.Combine(GetAvDir(), "ffmpeg.exe").Wrap()} {beforeArgs} {args}";
|
||||
else
|
||||
ffmpeg.StartInfo.Arguments = $"{GetCmdArg()} cd /D {GetAvDir().Wrap()} & ffmpeg.exe {beforeArgs} {args}";
|
||||
|
||||
if (logMode != LogMode.Hidden) Logger.Log("Running ffmpeg...", false);
|
||||
if (logMode != LogMode.Hidden) Logger.Log("Running FFmpeg...", false);
|
||||
Logger.Log($"ffmpeg {beforeArgs} {args}", true, false, "ffmpeg");
|
||||
ffmpeg.OutputDataReceived += FfmpegOutputHandler;
|
||||
ffmpeg.ErrorDataReceived += FfmpegOutputHandler;
|
||||
@@ -108,8 +108,15 @@ namespace Flowframes
|
||||
hidden = true;
|
||||
|
||||
bool replaceLastLine = currentLogMode == LogMode.OnlyLastLine;
|
||||
string trimmedLine = line.Remove("q=-0.0").Remove("size=N/A").Remove("bitrate=N/A").TrimWhitespaces();
|
||||
Logger.Log(trimmedLine, hidden, replaceLastLine, "ffmpeg");
|
||||
|
||||
if (line.StartsWith("frame=")) // Format stats
|
||||
{
|
||||
line = line.Remove("q=-0.0").Remove("size=N/A").Remove("bitrate=N/A").Replace("frame=", "Frame: ")
|
||||
.Replace("fps=", "FPS: ").Replace("q=", "QP: ").Replace("time=", "Time: ").Replace("speed=", "Relative Speed: ")
|
||||
.Replace("bitrate=", "Bitrate: ").Replace("Lsize=", "Size: ").Replace("size=", "Size: ").TrimWhitespaces();
|
||||
}
|
||||
|
||||
Logger.Log(line, hidden, replaceLastLine, "ffmpeg");
|
||||
|
||||
if (line.Contains(".srt: Invalid data found"))
|
||||
Logger.Log($"Warning: Failed to encode subtitle track {line.Split(':')[2]}. This track will be missing in the output file.");
|
||||
@@ -117,7 +124,7 @@ namespace Flowframes
|
||||
if (line.Contains("Could not open file"))
|
||||
Interpolate.Cancel($"FFmpeg Error: {line}");
|
||||
|
||||
if (line.Contains("No NVENC capable devices found") || line.Contains("Cannot load nvcuda.dll"))
|
||||
if (line.Contains("No NVENC capable devices found") || line.MatchesWildcard("*nvcuda.dll*"))
|
||||
Interpolate.Cancel($"FFmpeg Error: {line}\nMake sure you have an NVENC-capable Nvidia GPU.");
|
||||
|
||||
if (!hidden && showProgressBar && line.Contains("time="))
|
||||
@@ -129,7 +136,7 @@ namespace Flowframes
|
||||
|
||||
static bool HideMessage (string msg)
|
||||
{
|
||||
string[] hiddenMsgs = new string[] { "can produce invalid output", "deprecated pixel format" };
|
||||
string[] hiddenMsgs = new string[] { "can produce invalid output", "pixel format" };
|
||||
|
||||
foreach (string str in hiddenMsgs)
|
||||
if (msg.MatchesWildcard($"*{str}*"))
|
||||
|
||||
@@ -56,12 +56,14 @@ namespace Flowframes.Media
|
||||
|
||||
if(codec == Codec.H264)
|
||||
{
|
||||
args += $"-crf {Config.GetInt("h264Crf")} -preset {Config.Get("ffEncPreset")} -pix_fmt yuv420p";
|
||||
string preset = Config.Get("ffEncPreset").ToLower().Remove(" ");
|
||||
args += $"-crf {Config.GetInt("h264Crf")} -preset {preset} -pix_fmt yuv420p";
|
||||
}
|
||||
|
||||
if (codec == Codec.H265)
|
||||
{
|
||||
args += $"-crf {Config.GetInt("h265Crf")} -preset {Config.Get("ffEncPreset")} -pix_fmt yuv420p";
|
||||
string preset = Config.Get("ffEncPreset").ToLower().Remove(" ");
|
||||
args += $"-crf {Config.GetInt("h265Crf")} -preset {preset} -pix_fmt yuv420p";
|
||||
}
|
||||
|
||||
if (codec == Codec.NVENC264)
|
||||
@@ -80,8 +82,7 @@ namespace Flowframes.Media
|
||||
{
|
||||
int crf = Config.GetInt("vp9Crf");
|
||||
string qualityStr = (crf > 0) ? $"-b:v 0 -crf {crf}" : "-lossless 1";
|
||||
string cpuUsed = Config.GetInt("vp9Speed", 3).ToString();
|
||||
args += $"{qualityStr} -cpu-used {cpuUsed} -tile-columns 2 -tile-rows 2 -row-mt 1 -pix_fmt yuv420p";
|
||||
args += $"{qualityStr} {GetVp9Speed()} -tile-columns 2 -tile-rows 2 -row-mt 1 -pix_fmt yuv420p";
|
||||
}
|
||||
|
||||
if(codec == Codec.ProRes)
|
||||
@@ -97,6 +98,22 @@ namespace Flowframes.Media
|
||||
return args;
|
||||
}
|
||||
|
||||
static string GetVp9Speed ()
|
||||
{
|
||||
string preset = Config.Get("ffEncPreset").ToLower().Remove(" ");
|
||||
string arg = "";
|
||||
|
||||
if (preset == "veryslow") arg = "0";
|
||||
if (preset == "slower") arg = "1";
|
||||
if (preset == "slow") arg = "2";
|
||||
if (preset == "medium") arg = "3";
|
||||
if (preset == "fast") arg = "4";
|
||||
if (preset == "faster") arg = "5";
|
||||
if (preset == "veryfast") arg = "4 -deadline realtime";
|
||||
|
||||
return $"-cpu-used {arg}";
|
||||
}
|
||||
|
||||
public static bool ContainerSupportsAllAudioFormats (Interpolate.OutMode outMode, List<string> codecs)
|
||||
{
|
||||
if(codecs.Count < 1)
|
||||
|
||||
Reference in New Issue
Block a user