radek-k / FFMediaToolkit

FFMediaToolkit is a cross-platform video decoder/encoder library for .NET that uses FFmpeg native libraries. It supports video frames extraction, reading stream metadata and creating videos from bitmaps in any format supported by FFmpeg.
MIT License
352 stars 56 forks source link

FFmpegLoader.FFmpegPath on linux: Whre is this directory located/ How can I find it ? #80

Closed yagarea closed 3 years ago

yagarea commented 3 years ago

I am using arch linux. When I run whereis ffmpeg I get:

ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz

but when I put any of these direcotries in to FFmpegLoader.FFmpegPath is says:

Unhandled exception. System.DllNotFoundException: Cannot load required FFmpeg libraries from /usr/share/ffmpeg/ directory.
Make sure the "Build"Prefer 32-bit" option in the project settings is turned off.
For more informations please see https://github.com/radek-k/FFMediaToolkit#setup
 ---> System.DllNotFoundException: Unable to load DLL 'avutil.56 under /usr/share/ffmpeg/': The specified module could not be found.
   at FFmpeg.AutoGen.ffmpeg.LoadLibrary(String libraryName, Boolean throwException)
   at FFmpeg.AutoGen.ffmpeg.<>c.<.cctor>b__6_0(String libraryName)
   at FFmpeg.AutoGen.ffmpeg.<>c.<.cctor>b__6_727()
   at FFmpeg.AutoGen.ffmpeg.av_version_info()
   at FFMediaToolkit.FFmpegLoader.LoadFFmpeg()
   --- End of inner exception stack trace ---
   at FFMediaToolkit.FFmpegLoader.HandleLibraryLoadError(Exception exception)
   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 13
   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

How can I fix this ?
Thank you for help.

yagarea commented 3 years ago

Solution was to set:

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

because arch linux has different installation location than other distributions.