mirror of
https://github.com/n00mkrad/flowframes.git
synced 2026-09-01 19:51:28 +02:00
VP9 speed in config, sorted config keys, better config err handling
This commit is contained in:
@@ -63,7 +63,8 @@ namespace Flowframes.AudioVideo
|
||||
{
|
||||
int crf = Config.GetInt("vp9Crf");
|
||||
string qualityStr = (crf > 0) ? $"-crf {crf}" : "-lossless 1";
|
||||
args += $"{qualityStr} -cpu-used 3 -tile-columns 2 -tile-rows 2 -row-mt 1";
|
||||
string cpuUsed = Config.GetInt("vp9Speed", 3).ToString();
|
||||
args += $"{qualityStr} -cpu-used {cpuUsed} -tile-columns 2 -tile-rows 2 -row-mt 1";
|
||||
}
|
||||
|
||||
if(codec == Codec.ProRes)
|
||||
|
||||
@@ -17,16 +17,23 @@ namespace Flowframes.IO
|
||||
public static void Init()
|
||||
{
|
||||
configPath = Path.Combine(Paths.GetDataPath(), "config.ini");
|
||||
if (!File.Exists(configPath))
|
||||
{
|
||||
File.Create(configPath).Close();
|
||||
}
|
||||
IOUtils.CreateFileIfNotExists(configPath);
|
||||
Reload();
|
||||
}
|
||||
|
||||
public static void Set(string key, string value)
|
||||
{
|
||||
string[] lines = File.ReadAllLines(configPath);
|
||||
string[] lines = new string[1];
|
||||
try
|
||||
{
|
||||
lines = File.ReadAllLines(configPath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Failed to read config file!\nFlowframes will try to re-create the file if it does not exist.", "Error");
|
||||
if(!File.Exists(configPath))
|
||||
Init();
|
||||
}
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
if (lines[i].Split('|')[0] == key)
|
||||
@@ -39,6 +46,7 @@ namespace Flowframes.IO
|
||||
}
|
||||
List<string> list = lines.ToList();
|
||||
list.Add(key + "|" + value);
|
||||
list = list.OrderBy(p => p).ToList();
|
||||
File.WriteAllLines(configPath, list.ToArray());
|
||||
cachedLines = list.ToArray();
|
||||
}
|
||||
|
||||
@@ -617,5 +617,22 @@ namespace Flowframes.IO
|
||||
DirectoryInfo dir = new DirectoryInfo(path);
|
||||
return dir.GetFiles(pattern, opt).OrderBy(x => x.Name).ToArray();
|
||||
}
|
||||
|
||||
public static bool CreateFileIfNotExists (string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
File.Create(path).Close();
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log($"Failed to create file at '{path}': {e.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user