SIPSorceryMedia.FFmpeg icon indicating copy to clipboard operation
SIPSorceryMedia.FFmpeg copied to clipboard

System.NotSupportedException: Specified method is not supported (MacOS)

Open FinHorsley opened this issue 11 months ago • 13 comments

Hi there,

Sorry in advance if i've missed something obvious, but i've been through the existing issues for this and i'm still hitting the NotSupportedException

Environment Macos - 15.0.1 (24A348) M1

I've downloaded ffmpeg from brew

brew install ffmpeg@6 (think i need to use v6, rather than latest, see https://github.com/sipsorcery-org/SIPSorceryMedia.FFmpeg/issues/70#issuecomment-1910670581). I've also tried with v4 and latest

that installs it to

/opt/homebrew/opt/ffmpeg@6/bin

$ /opt/homebrew/opt/ffmpeg@6/bin/ffmpeg -version
ffmpeg version 6.1.2 Copyright (c) 2000-2024 the FFmpeg developers

i've then set this in the Initialise

FFmpegInit.Initialise(FfmpegLogLevelEnum.AV_LOG_TRACE, libPath: "/opt/homebrew/opt/ffmpeg@6/bin", logger);

and have also tried lib

FFmpegInit.Initialise(FfmpegLogLevelEnum.AV_LOG_TRACE, libPath: "/opt/homebrew/opt/ffmpeg@6/lib", logger);

either way i get the exception

FFmpeg binaries path set to: /opt/homebrew/opt/ffmpeg@6/lib 👈 including for clarity is either /lib or /bin
Unhandled exception. System.NotSupportedException: Specified method is not supported.
   at FFmpeg.AutoGen.DynamicallyLoadedBindings.<>c.<Initialize>b__2_1227()
   at FFmpeg.AutoGen.DynamicallyLoadedBindings.<>c.<Initialize>b__2_516()
   at FFmpeg.AutoGen.ffmpeg.avdevice_register_all()
   at SIPSorceryMedia.FFmpeg.FFmpegInit.SetFFmpegBinariesPath(String path)
   at SIPSorceryMedia.FFmpeg.FFmpegInit.RegisterFFmpegBinaries(String libPath)
   at SIPSorceryMedia.FFmpeg.FFmpegInit.Initialise(Nullable`1 logLevel, String libPath, ILogger appLogger)
   at Program.<Main>$(String[] args) in /REDACTED
   at Program.<Main>(String[] args)

FinHorsley avatar Dec 05 '24 17:12 FinHorsley

quite new to ffmpeg, not sure if this is useful image

FinHorsley avatar Dec 05 '24 17:12 FinHorsley

Does it work if its version 6.1.1?

ha-ves avatar Dec 06 '24 08:12 ha-ves

doesn't look like it, still getting the same error

ffmpeg -version
ffmpeg version 6.1.1-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers

for anyone else, downloaded 6.1.1 using https://gist.github.com/isimaka/0a43cbec585a019d3c4550068a288475

side note it looks like -enable-sharing is missing from ffmpeg -buildconf

FinHorsley avatar Dec 06 '24 09:12 FinHorsley

static builds don't expose the shared libraries.

Homebrew specifies the shared libraries here:

    # Build and install additional FFmpeg tools
    system "make", "alltools"
    bin.install (buildpath/"tools").children.select { |f| f.file? && f.executable? }
    (share/"ffmpeg").install buildpath/"tools/python"

via ChatGPT:

(share/"ffmpeg").install buildpath/"tools/python":

Copies the python directory from the tools directory of the build path to the share/ffmpeg directory in the Homebrew installation prefix.

Where is the share folder?

The share folder is located inside Homebrew's installation prefix, typically under /usr/local/share on macOS (for Intel Macs) or /opt/homebrew/share on Apple Silicon Macs.

To find its exact location: Run brew --prefix to get the Homebrew prefix path.

Combine it with share/ffmpeg. For example: Intel: /usr/local/share/ffmpeg Apple Silicon: /opt/homebrew/share/ffmpeg

You can try passing the method parameter with those paths.

ha-ves avatar Dec 06 '24 23:12 ha-ves

The latest nuget package requires FFmpeg version 7.

See the Windows instuctions for the version.

sipsorcery avatar Dec 07 '24 18:12 sipsorcery

Thanks for the reply (apologies for my slow reply!). I ended up downgrading to an older ffmpeg version and initialised with FFmpegInit.Initialise(FfmpegLogLevelEnum.AV_LOG_TRACE, libPath: "/opt/homebrew/Cellar/ffmpeg@4/4.4.5_3/lib", logger); which seemed to work well enough to get started. I'll have a play with bumping now i've got it working 🙂

FinHorsley avatar Dec 13 '24 09:12 FinHorsley

Getting this same problem on Win11 build 26100 with ffmpeg shared 7.0 installed exactly per the installation instructions and then also manually added to the system path.

kevinmershon avatar Feb 27 '25 21:02 kevinmershon

That's weird. I'm on exactly the same Windows version and have been using the FFmpeg package constantly for the last few weeks.

> ffmpeg version
ffmpeg version 7.0-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developer

Is there a chance you have another ffmpeg version installed?

where ffmpeg

sipsorcery avatar Feb 27 '25 21:02 sipsorcery

 ffmpeg version
ffmpeg version 7.0-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13.2.0 (Rev5, Built by MSYS2 project)

And unless I manually put it on the path, where ffmpeg returns empty

kevinmershon avatar Feb 27 '25 21:02 kevinmershon

If you do dotnet run on this WebRTC MP4 demo do you get that exception?

sipsorcery avatar Feb 27 '25 21:02 sipsorcery

If you do dotnet run on this WebRTC MP4 demo do you get that exception?

I cloned the repo and ran dotnet run on that project but it is non-obvious how to test it to get to a point where the video track would be encoding. Opening port 8081 in a browser didn't load anything.

kevinmershon avatar Feb 27 '25 22:02 kevinmershon

I was able to get this output trying to run the receiver

Image

kevinmershon avatar Feb 27 '25 22:02 kevinmershon

On my machine:

WebRTC Receive Demo
[22:15:10 INF] FFmpeg binaries found in system path at: C:\Users\AaronClauson\AppData\Local\Microsoft\WinGet\Packages\Gyan.FFmpeg.Shared_Microsoft.Winget.Source_8wekyb3d8bbwe\ffmpeg-7.0-full_build-shared\bin
[22:15:10 INF] FFmpeg version info: 7.0-full_build-www.gyan.dev
Starting web socket server...
Waiting for web socket connections on ws://0.0.0.0:8081...
[22:16:09 DBG] Web socket client connection from 127.0.0.1:53987.
[22:16:10 DBG] No DTLS certificate is provided in the configuration
[22:16:10 DBG] RTCPeerConnection created with DTLS certificate with fingerprint sha-256 A8:A7:80:FD:ED:73:23:03:D9:EC:42:4A:87:48:09:E8:B5:C6:82:30:09:CD:34:1B:3F:F7:47:4E:76:19:1C:E9 and signature algorithm SHA256withECDSA.
[22:16:10 DBG] CreateRtpSocket attempting to create and bind RTP socket(s) on [::]:0.
[22:16:10 DBG] CreateBoundSocket attempting to create and bind socket(s) on [::]:0 using protocol Udp.
[22:16:10 DBG] CreateBoundSocket even port required, closing socket on [::]:63395 and retrying on 63396.
[22:16:10 DBG] Successfully bound RTP socket [::]:63396 (dual mode True).
[22:16:10 DBG] RTPChannel for [::]:63396 started.
[22:16:10 DBG] SCTP windows size for data receiver set at 218.
[22:16:10 DBG] SCTP creating DTLS based association, is DTLS client False, ID 5000:5000:63396.
[22:16:10 DBG] RTP ICE Channel discovered 2 local candidates.

Maybe there's an incorrect version of the FFmpeg.AutoGen nuget package somewhere but I'm only guessing. .NET and native libraries never work that well together. These types of issues have always been a plague.

sipsorcery avatar Feb 27 '25 22:02 sipsorcery