Error: The path is not of a legal form while using NReco.VideoConverter
Error: The path is not of a legal form while using NReco.VideoConverter
我正在尝试使用 NReco.VideoConverter 将 .flac 文件转换为 .wav 文件,但我一直收到错误消息,我不知道为什么。
这是我用于转换的代码片段:
//Create the NReco.VideoConverter.FFMpegConverter object
var ffmpeg = new FFMpegConverter();
//inputFile will be something like this:
//type: string, "C:\some\folder\fullTrackName" + ".flac"
var inputFile = Path.Combine(downloadFolder + fullTrackNameNoExtension + ".flac");
//outputFile will be something like this:
//type: string, "C:\some\folder\musicfile" + ".wav"
var outputFile = Path.Combine(downloadFolder + fullTrackNameNoExtension + ".wav");
//Convert the file using NReco.VideoConverter.FFMpegConverter
ffmpeg.ConvertMedia(inputFile, outputFile, null);
inputFile/outputFile 会像这样,这是我在插入断点并检查 in/outputFile:
的值时看到的
字符串,inputFile/outputFile:"Z:\Downloads\Audio - File (Original Mix).flac"(或.wav)
这是我在 运行 ffmpeg.ConvertMedia:
时收到的错误
System.ArgumentException: The path is not of a legal form.
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.IO.File.InternalGetLastWriteTimeUtc(String path, Boolean checkHost)
at NReco.VideoConverter.FFMpegConverter.EnsureFFMpegLibs()
at NReco.VideoConverter.FFMpegConverter.ConvertMedia(Media input, Media output, ConvertSettings settings)
at NReco.VideoConverter.FFMpegConverter.ConvertMedia(String inputFile, String inputFormat, String outputFile, String outputFormat, ConvertSettings settings)
at NReco.VideoConverter.FFMpegConverter.ConvertMedia(String inputFile, String outputFile, String outputFormat)
at APPLICATION_Name.APPLICATION_Class.ConvertFile(String downloadFolder, String fullTrackName, String fullTrackNameNoExtension, String downloadQuality, String downloadType) in X:\APPLICATION_Name\DownloadTrack.cs:line 244
首次使用时提取 ffmpeg 二进制文件(默认为 app bin 文件夹)的 "FFMpegConverter.EnsureFFMpegLibs" 方法抛出异常,我可能认为由于某种原因它被错误地确定(或者可能使用了网络路径) .
您可以尝试通过指定 FFMpegConverter.FFMpegToolPath 属性 来更改 ffmpeg.exe 的位置(.net 应用程序应该有足够的权限写入此文件夹)。
我正在尝试使用 NReco.VideoConverter 将 .flac 文件转换为 .wav 文件,但我一直收到错误消息,我不知道为什么。 这是我用于转换的代码片段:
//Create the NReco.VideoConverter.FFMpegConverter object
var ffmpeg = new FFMpegConverter();
//inputFile will be something like this:
//type: string, "C:\some\folder\fullTrackName" + ".flac"
var inputFile = Path.Combine(downloadFolder + fullTrackNameNoExtension + ".flac");
//outputFile will be something like this:
//type: string, "C:\some\folder\musicfile" + ".wav"
var outputFile = Path.Combine(downloadFolder + fullTrackNameNoExtension + ".wav");
//Convert the file using NReco.VideoConverter.FFMpegConverter
ffmpeg.ConvertMedia(inputFile, outputFile, null);
inputFile/outputFile 会像这样,这是我在插入断点并检查 in/outputFile:
的值时看到的字符串,inputFile/outputFile:"Z:\Downloads\Audio - File (Original Mix).flac"(或.wav)
这是我在 运行 ffmpeg.ConvertMedia:
时收到的错误System.ArgumentException: The path is not of a legal form.
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.IO.File.InternalGetLastWriteTimeUtc(String path, Boolean checkHost)
at NReco.VideoConverter.FFMpegConverter.EnsureFFMpegLibs()
at NReco.VideoConverter.FFMpegConverter.ConvertMedia(Media input, Media output, ConvertSettings settings)
at NReco.VideoConverter.FFMpegConverter.ConvertMedia(String inputFile, String inputFormat, String outputFile, String outputFormat, ConvertSettings settings)
at NReco.VideoConverter.FFMpegConverter.ConvertMedia(String inputFile, String outputFile, String outputFormat)
at APPLICATION_Name.APPLICATION_Class.ConvertFile(String downloadFolder, String fullTrackName, String fullTrackNameNoExtension, String downloadQuality, String downloadType) in X:\APPLICATION_Name\DownloadTrack.cs:line 244
首次使用时提取 ffmpeg 二进制文件(默认为 app bin 文件夹)的 "FFMpegConverter.EnsureFFMpegLibs" 方法抛出异常,我可能认为由于某种原因它被错误地确定(或者可能使用了网络路径) .
您可以尝试通过指定 FFMpegConverter.FFMpegToolPath 属性 来更改 ffmpeg.exe 的位置(.net 应用程序应该有足够的权限写入此文件夹)。