Skip to content

Debug FFmpeg Loading

Speykious edited this page Feb 23, 2022 · 1 revision

Starting from SeeShark v3.1.0, you can log the native library searching process very easily.

All you need to do is set FFmpegManager.LogLibrarySearch to true before calling SetupFFmpeg().

You will then see dark-cyan text logged in stderr about the paths being searched, the name of the library it is searching for, and if it found it or not.

Here are 2 examples, one failing and one successful, ran on my Arch Linux machine.

Failing Example

using SeeShark.FFmpeg;

FFmpegManager.LogLibrarySearch = true;
FFmpegManager.SetupFFmpeg(
    "/path/that/doesnt/exist",
    "/somewhere/else/",
    "/usr/libbb/",
);

Console.WriteLine($"FFmpeg version info: {FFmpegManager.FFmpegVersion}");

Result:

Setting up FFmpeg
Required libraries:
  - avcodec (v59)
  - avdevice (v59)
  - avformat (v59)
  - swscale (v6)
Searching for libraries in /path/that/doesnt/exist
  Couldn't find library libavcodec.so.59
Searching for libraries in /somewhere/else/
  Couldn't find library libavcodec.so.59
Searching for libraries in /usr/libbb/
  Couldn't find library libavcodec.so.59
Unhandled exception. System.InvalidOperationException: Couldn't find native libraries in the following paths:
  - /path/that/doesnt/exist
  - /somewhere/else/
  - /usr/libbb/
Make sure you installed the correct versions of the native libraries.
    [...]

Successful Example

using SeeShark.FFmpeg;

FFmpegManager.LogLibrarySearch = true;
FFmpegManager.SetupFFmpeg(
    "/path/that/doesnt/exist",
    "/somewhere/else/",
    "/usr/lib/",
);

Console.WriteLine($"FFmpeg version info: {FFmpegManager.FFmpegVersion}");

Result:

Setting up FFmpeg
Required libraries:
  - avcodec (v59)
  - avdevice (v59)
  - avformat (v59)
  - swscale (v6)
Searching for libraries in /path/that/doesnt/exist
  Couldn't find library libavcodec.so.59
Searching for libraries in /somewhere/else/
  Couldn't find library libavcodec.so.59
Searching for libraries in /usr/lib/
  Found library libavcodec.so.59
  Found library libavdevice.so.59
  Found library libavformat.so.59
  Found library libswscale.so.6
FFmpeg version info: n5.0