Search code examples
c#nrecofody-costura

NReco FFPMegConverter: The path is not of a legal form


I'm using the NReco FFMPegConverter, and when I try to get a thumbnail, I get the error:

 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.ExtractFFmpeg()

Here is the line of code where I'm getting my error.

        var filep = domainVideoFile.AbsolutePath;
        _fFMpegConverter.GetVideoThumbnail(filep, tempfileName);

In the above example, filep = "C:\Users\me_000\Downloads\GRoma\G.mp4" and tempFileName = "C:\Users\me_000\Desktop\f480b6c0.jpeg"when copied directly from the Locals view in Debug mode.

There is another thread citing this issue on SO and the stated solution is to set the FFMPegToolPath property.

 fFMpegConverter.FFMpegToolPath = _thumbPathManager.GetFFMPegPath;

I've tried that and various versions of it and I still get the error. I'm using the version of 1.1.2.0 if that helps.

The error pops up no matter what I do with respect to calling FFMpegToolPath, ExtractFFmpeg and what not.

Any help is greatly appreciated.


Solution

  • The problem was very insidious but I figured out what was happening.

    I'm using Fody.Costura to merge my DLL resources. This works for all the other DLLS, but the NReco DLLs don't take kindly to being merged. I guess somewhere along the way this is causing file pathing issues since the DLL doesn't exist as a standalone file.