You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The extension comparison should be case-insensitive, so ".MP4" == ".mp4"
When the extensions don't match, the Path.Combine(...) puts the output filename w/o extension as a subdirectory of the output directory, instead of as the filename. I.E. for output = "C:\Temp\FooBar.MP4" and input extension = ".mp4", the output file is set to "C:\Temp\FooBar.mp4" instead of "C:\Temp\FooBar.mp4". An exception occurs, because the new subdirectory "FooBar" doesn't exist.
2 issues:
Code snippet shown below.
private static FFMpegArgumentProcessor BaseSubVideo(string input, string output, TimeSpan startTime, TimeSpan endTime)
{
if (Path.GetExtension(input) != Path.GetExtension(output))
{
output = Path.Combine(Path.GetDirectoryName(output), Path.GetFileNameWithoutExtension(output), Path.GetExtension(input));
}
.
.
.
}
private static FFMpegArgumentProcessor BaseSubVideo(string input, string output, TimeSpan startTime, TimeSpan endTime) { if (Path.GetExtension(input) != Path.GetExtension(output)) { output = Path.Combine(Path.GetDirectoryName(output), Path.GetFileNameWithoutExtension(output), Path.GetExtension(input)); } . . . }
The code snippet should look like this (although invariant versions could be used)):
if (Path.GetExtension(input).ToLower() != Path.GetExtension(output).ToLower())
{
output = Path.Combine(Path.GetDirectoryName(output), Path.GetFileNameWithoutExtension(output) + Path.GetExtension(input));
}
The text was updated successfully, but these errors were encountered: