mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-23 03:39:26 +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()
|
public float GetFloat()
|
||||||
{
|
{
|
||||||
|
if (Denominator < 1) // Avoid div by zero
|
||||||
|
return 0f;
|
||||||
|
|
||||||
return (float)Numerator / (float)Denominator;
|
return (float)Numerator / (float)Denominator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -280,22 +280,34 @@ namespace Flowframes
|
|||||||
|
|
||||||
private void fpsInTbox_TextChanged(object sender, EventArgs e)
|
private void fpsInTbox_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
fpsInTbox.Text = fpsInTbox.Text.TrimNumbers(true);
|
UpdateUiFps();
|
||||||
UpdateOutputFPS();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateOutputFPS()
|
public void UpdateUiFps()
|
||||||
{
|
{
|
||||||
float fpsOut = fpsInTbox.GetFloat() * interpFactorCombox.GetFloat();
|
if (fpsInTbox.Text.Contains("/")) // Parse fraction
|
||||||
fpsOutTbox.Text = fpsOut.ToString();
|
{
|
||||||
|
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)
|
if (!fpsInTbox.ReadOnly)
|
||||||
currInFps = new Fraction(fpsInTbox.GetFloat());
|
currInFps = new Fraction(fpsInTbox.GetFloat());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void interpFactorCombox_SelectedIndexChanged(object sender, EventArgs e)
|
private void interpFactorCombox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateOutputFPS();
|
UpdateUiFps();
|
||||||
int guiInterpFactor = interpFactorCombox.GetInt();
|
int guiInterpFactor = interpFactorCombox.GetInt();
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -218,6 +218,12 @@ namespace Flowframes.Main
|
|||||||
|
|
||||||
public static async Task MuxOutputVideo(string inputPath, string outVideo)
|
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"))
|
if (!Config.GetBool("keepAudio") && !Config.GetBool("keepAudio"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ namespace Flowframes.Main
|
|||||||
}
|
}
|
||||||
if (passes && fpsOut.GetFloat() < 1f || fpsOut.GetFloat() > 1000f)
|
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;
|
passes = false;
|
||||||
}
|
}
|
||||||
if (!passes)
|
if (!passes)
|
||||||
|
|||||||
Reference in New Issue
Block a user