I've seen tens of questions and answers concerning this subject but I still couldn't solve my problem.
I'm using an external ffmpeg converter in my code and I'm passing a file path as an argument like this:
OutputPackage oo = converter.ConvertToFLV(@"C:\Users\user\Documents\test Video\video.wmv");
When there is no space in "test Video" folder name ,then it works fine. But when it's like above I get an error that C:\Users\user\Documents\test is not a valid path.
Surrounding it with quotes like:
@"""C:\Users\user\Documents\test Video\video.wmv"""
results with
The video file "C:\Users\user\Documents\test Video\video.wmv" does not exist.
I also tried without the "@":
"\"C:\\Users\\user\\Documents\\test Video\\video.wmv\""
but the result is the same.
Path.Combine("C:\\Users\\user\\Documents\\test Video\\video.wmv")
"\""+Path.Combine("C:\\Users\\user\\Documents\\test Video\\video.wmv")+"\""
also doesn't work. In the same time running the process form Windows Console like
ffmpeg.exe "C:\Users\user\Documents\test Video\video.wmv"
works totally fine.
UPDATE: The method uses the string like this:
public OutputPackage ConvertToFLV(string inputPath)
{
VideoFile vf = null;
try
{
//string path = string.Format("{0}", inputPath);
vf = new VideoFile(inputPath);
}
catch (Exception ex)
{
throw ex;
}
OutputPackage oo = ConvertToFLV(vf);
return oo;
}
and
In the video file class the exception is thrown here:
if (!File.Exists(_Path))
{
throw new Exception("The video file " + _Path + " does not exist.");
}
It could be that converter.ConvertToFLV doesn't handle path names with spaces in them correctly. You can try giving it the 8.3 pathname which doesn't have spaces
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With