C# on linux: FFmpeg (FFMediaToolkit) on linux System.IO.DirectoryNotFoundException: Cannot found the default FFmpeg directory


I have C# project in rider and FFMediaToolkit installed via NuGet. I made instance of MediaBuilder. When I hit run I get this error message:

/home/john/Projects/Slimulator/bin/Debug/net5.0/Slimulator /home/john/Projects/Slimulator/test_mazes/small-maze-food2.png
Loading file /home/john/Projects/Slimulator/test_mazes/small-maze-food2.png
Unhandled exception. System.IO.DirectoryNotFoundException: Cannot found the default FFmpeg directory.
On Windows you have to set "FFmpegLoader.FFmpegPath" with full path to the directory containing FFmpeg shared build ".dll" files
For more informations please see https://github.com/radek-k/FFMediaToolkit#setup
   at FFMediaToolkit.FFmpegLoader.LoadFFmpeg()
   at FFMediaToolkit.Encoding.Internal.OutputContainer.Create(String extension)
   at FFMediaToolkit.Encoding.MediaBuilder..ctor(String path, Nullable`1 format)
   at FFMediaToolkit.Encoding.MediaBuilder.CreateContainer(String path)
   at Slimulator.AnimationBuffer..ctor(String videoPath, Int32 height, Int32 width, Int32 frameRate) in /home/john/Projects/Slimulator/AnimationBuffer.cs:line 11
   at Slimulator.Simulation..ctor(Space space, String seed, String outputVideoPath) in /home/john/Projects/Slimulator/Simulation.cs:line 12
   at Slimulator.Launcher.Main(String[] args) in /home/john/Projects/Slimulator/Launcher.cs:line 8

Process finished with exit code 134.

When I go to https://github.com/radek-k/FFMediaToolkit#setup I find just this:

Linux – Download FFmpeg using your package manager.

You need to set FFmpegLoader.FFmpegPath with a full path to FFmpeg libraries.

If you want to use 64-bit FFmpeg, you have to disable the Build -> Prefer 32-bit option in
Visual Studio project properties.

I have already installed FFmpeg package via pacman and I am still getting these error.

How can I fix this so I can use FFMediaToolkit without problem on linux ?
Thank you for help

EDIT1: I use Arch linux.
EDIT2: There is related issue on github: https://github.com/radek-k/FFMediaToolkit/issues/80


Solution was to set:

FFmpegLoader.FFmpegPath = "/usr/lib/";

because arch linux has different installation location than other distributions.

Answered By – Jan Černý

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published