mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-22 19:29:24 +01:00
Allow fractional manual fps input, better err handling if encoding fails
This commit is contained in:
@@ -219,6 +219,9 @@ namespace Flowframes.Data
|
||||
|
||||
public float GetFloat()
|
||||
{
|
||||
if (Denominator < 1) // Avoid div by zero
|
||||
return 0f;
|
||||
|
||||
return (float)Numerator / (float)Denominator;
|
||||
}
|
||||
|
||||
|
||||
@@ -280,22 +280,34 @@ namespace Flowframes
|
||||
|
||||
private void fpsInTbox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
fpsInTbox.Text = fpsInTbox.Text.TrimNumbers(true);
|
||||
UpdateOutputFPS();
|
||||
UpdateUiFps();
|
||||
}
|
||||
|
||||
public void UpdateOutputFPS()
|
||||
public void UpdateUiFps()
|
||||
{
|
||||
float fpsOut = fpsInTbox.GetFloat() * interpFactorCombox.GetFloat();
|
||||
fpsOutTbox.Text = fpsOut.ToString();
|
||||
if (fpsInTbox.Text.Contains("/")) // Parse fraction
|
||||
{
|
||||
string[] split = fpsInTbox.Text.Split('/');
|
||||
Fraction frac = new Fraction(split[0].GetInt(), split[1].GetInt());
|
||||
fpsInTbox.Text = frac.ToString();
|
||||
fpsOutTbox.Text = (frac * interpFactorCombox.GetFloat()).ToString();
|
||||
|
||||
if (!fpsInTbox.ReadOnly)
|
||||
currInFps = frac;
|
||||
}
|
||||
else // Parse float
|
||||
{
|
||||
fpsInTbox.Text = fpsInTbox.Text.TrimNumbers(true);
|
||||
fpsOutTbox.Text = (fpsInTbox.GetFloat() * interpFactorCombox.GetFloat()).ToString();
|
||||
|
||||
if (!fpsInTbox.ReadOnly)
|
||||
currInFps = new Fraction(fpsInTbox.GetFloat());
|
||||
}
|
||||
}
|
||||
|
||||
private void interpFactorCombox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateOutputFPS();
|
||||
UpdateUiFps();
|
||||
int guiInterpFactor = interpFactorCombox.GetInt();
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
@@ -218,6 +218,12 @@ namespace Flowframes.Main
|
||||
|
||||
public static async Task MuxOutputVideo(string inputPath, string outVideo)
|
||||
{
|
||||
if (!File.Exists(outVideo))
|
||||
{
|
||||
I.Cancel($"No video was encoded!\n\nFFmpeg Output:\n{AvProcess.lastOutputFfmpeg}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Config.GetBool("keepAudio") && !Config.GetBool("keepAudio"))
|
||||
return;
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace Flowframes.Main
|
||||
}
|
||||
if (passes && fpsOut.GetFloat() < 1f || fpsOut.GetFloat() > 1000f)
|
||||
{
|
||||
ShowMessage("Invalid output frame rate - Must be 1-1000.");
|
||||
ShowMessage($"Invalid output frame rate ({fpsOut.GetFloat()}).\nMust be 1-1000.");
|
||||
passes = false;
|
||||
}
|
||||
if (!passes)
|
||||
|
||||
Reference in New Issue
Block a user