Skip to content

Commit a9efedb

Browse files
committed
GetIgnoreStringsFromFfmpegCmd: Error handling
1 parent 49dad7e commit a9efedb

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

ff-utils-winforms/Media/AvProcess.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,22 @@ public static async Task<string> RunFfmpeg(string args, string workingDir, LogMo
108108

109109
private static string[] GetIgnoreStringsFromFfmpegCmd (string cmd)
110110
{
111-
string inputPath = cmd.Split(" -i ")[1].Split("\"")[1].Trim();
112-
string[] splitByQuotes = cmd.Split("\"");
113-
string outPath = splitByQuotes[splitByQuotes.Length - 2];
114-
Logger.Log($"Filtering out input path ({inputPath}) and output path ({outPath})");
115-
return new string[] { inputPath, outPath };
111+
List<string> strs = new List<string>();
112+
113+
try
114+
{
115+
strs.Add(cmd.Split(" -i ")[1].Split("\"")[1].Trim());
116+
}
117+
catch { }
118+
119+
try
120+
{
121+
string[] splitByQuotes = cmd.Split("\"");
122+
strs.Add(splitByQuotes[splitByQuotes.Length - 2]);
123+
}
124+
catch { }
125+
126+
return strs.ToArray();
116127
}
117128

118129
public static async Task<string> GetFfmpegOutputAsync(string args, bool setBusy = false, bool progressBar = false)

0 commit comments

Comments
 (0)