SIPSorceryMedia.FFmpeg 10.0.16

SIPSorceryMedia.FFmpeg

NuGet NuGet downloads

Cross-platform audio and video media end-points for the SIPSorcery real-time communications library, built on top of native FFmpeg libraries via FFmpeg.AutoGen.

Tested on Windows, macOS, and Linux.

Licence note. Unlike the rest of the SIPSorcery family this package is licensed under LGPL-2.1-only (because it links FFmpeg at runtime, and FFmpeg's default build is LGPL). Make sure that's acceptable for your application before depending on it.

Installation

dotnet add package SIPSorcery
dotnet add package SIPSorceryMedia.FFmpeg

You also need the FFmpeg shared libraries installed on the target machine -- this NuGet package wraps FFmpeg, it doesn't ship the binaries. See Installing FFmpeg below.

What is in here

Codecs

  • Video: VP8, H.264, H.265, MJPEG.
  • Audio: PCMU (G.711), PCMA (G.711), G.722, G.729, Opus.

Sources

Class Source kind
FFmpegFileSource Local files or remote URIs (HTTP, RTSP, ...) -- audio + video.
FFmpegCameraSource Local webcam capture -- video.
FFmpegScreenSource Screen / monitor capture -- video.
FFmpegMicrophoneSource Microphone capture -- audio.

You can mix any video source (or none) with any audio source (or none) when assembling a media session.

Encoders / decoders

Class Purpose
FFmpegVideoEncoder IVideoEncoder -- VP8 / H.264 / H.265 / MJPEG encode + decode.
FFmpegAudioEncoder IAudioEncoder -- audio codec encode + decode for the codecs above.
FFmpegVideoEndPoint Convenience pairing of source + encoder + sink.

Limitations

  • No audio output. This package does not provide a speaker / playback end-point. For audio playback pair it with a platform end-point such as SIPSorceryMedia.Windows on Windows or SIPSorcery.SDL2 on other platforms.

Installing FFmpeg

The shared libraries this package binds to must be discoverable on the target machine's library load path. Typical setups:

Windows

The simplest path is winget:

winget install "FFmpeg (Shared)" --version 8.1

That puts the DLLs somewhere SIPSorceryMedia.FFmpeg can find them.

Alternative -- download a "shared" build from gyan.dev/ffmpeg/builds/#release-builds or use the binaries shipped with FFmpeg.AutoGen, and add them to your PATH.

Linux

sudo apt install ffmpeg

(Equivalent for dnf, pacman, etc. on other distributions.)

macOS

brew install ffmpeg
brew install mono-libgdiplus    # for the test apps that draw bitmaps

FFmpeg version compatibility

This package targets the FFmpeg 8.1 ABI via FFmpeg.AutoGen 8.1.0. Older or much newer FFmpeg installations may load with PInvoke errors. If you see EntryPointNotFoundException or DllNotFoundException at startup, the most common cause is an FFmpeg version mismatch.

Quickstart -- WebRTC video to a browser

The WebRTCTestPatternServer example shows the minimal end-to-end path: a video test-pattern source, encoded with FFmpeg's H.264 encoder, sent over WebRTC to a browser.

Sketch:

using SIPSorcery.Media;
using SIPSorcery.Net;
using SIPSorceryMedia.FFmpeg;

FFmpegInit.Initialise();   // load the shared libs on whatever PATH is configured

var pc = new RTCPeerConnection(null);
var source = new VideoTestPatternSource(new FFmpegVideoEncoder());

var track = new MediaStreamTrack(source.GetVideoSourceFormats(), MediaStreamStatusEnum.SendOnly);
pc.addTrack(track);

source.OnVideoSourceEncodedSample += pc.SendVideo;
pc.OnVideoFormatsNegotiated += formats => source.SetVideoSourceFormat(formats.First());

Testing

The repo includes a console test harness at test/FFmpegFileAndDevicesTest that exercises file, camera, and screen sources end-to-end.

License

LGPL-2.1-only. The rest of the SIPSorcery family is BSD-3-Clause; this package is the exception because of FFmpeg's licensing.

No packages depend on SIPSorceryMedia.FFmpeg.

-v10.0.16: Updated nuget packages to latest stable versions. -v10.0.15: Updated for main sipsorcery library release. -v10.0.13: Fix license file. -v10.0.12: Updated for main sipsorcery library release. -v10.0.11: Updated for main sipsorcery library release. -v10.0.10: Add and improve support for video codecs including H265, VP9 and AV1. -v10.0.9: Updated for main sipsorcery library release. -v10.0.8: Full library release. -v10.0.7: Updated for main sipsorcery library release. -v10.0.6: Updated for main sipsorcery library release. -v10.0.5: Updated for main sipsorcery library release. -v8.0.12: Updated to latest abstractions package. -v8.0.10: H265 and MJPEG support. RTCP feedback improvements. -v8.0.8: Bug fixes, including segfault fix, for FFmpeg file source. -v8.0.7: Updated to latest abstractions package. -v1.4.2: Update to FFmpeg.AutoGen v7.0.0. -v1.4.1: Bump SIPSorceryMedia.Abstractions to 1.2.1. -v1.4.0: Stable release. -v1.3.0-pre: Removed FFmpeg binaries from nuget package. On Windows use winget to obtain FFmpeg. -v1.1.0: Enhance Audio Source encoding. Audio Codecs tested: PCMU (G711), PCMA (G711), G722, G729 and Opus -v1.0.0: Use SIPSorceryMedia.Abstractions v1.2.0. Add Camera and Monitor detection on MacOs -v0.0.18-pre: More great work and features from @ChristopheI. Netstandard2.0 target added. -v0.0.12-pre: New features from @ChristopheI, including camera and microphone sources. -v0.0.11-pre: Changed target framework from netcoreapp3.1 to netstandard2.1 for wider platform support. -v0.0.10-pre: Updated to use latest abstractons package with change to IAudioEncoder and IVideoEncoder interfaces. -v0.0.9-pre: Updated to use latest abstractions nuget package and video format parameter on IVideoSink.GotVideoFrame. -v0.0.8-pre: Fixed the video decoder to return BGR instead of RGB. -v0.0.7-pre: Updated the video encoder class to support the IVideoEncoder interface. -v0.0.6-pre: Updated to use latest abstractions nuget package. -v0.0.5-pre: Use pixel conversion class from abstractions package. -v0.0.4-pre: Added codec manager support to FFmpegVideoEndPoint. -v0.0.3-pre: Fixed bugs passing frames between file source decoder and video encoder. -v0.0.2-pre: Added file based source. -v0.0.1-pre: Initial release.

Version Downloads Last updated
10.0.16 1 08/19/2026
10.0.15 0 08/10/2026
10.0.14 0 08/10/2026
10.0.13 0 07/29/2026
10.0.12 0 07/13/2026
10.0.11 0 06/27/2026
10.0.10 0 06/17/2026
10.0.9 0 06/07/2026
10.0.8 0 05/23/2026
10.0.7 0 05/18/2026
10.0.5 0 04/24/2026
8.0.12 8 05/26/2026
8.0.10 0 03/09/2025
8.0.8 0 01/11/2025
8.0.7 0 01/04/2025
1.4.2 0 09/24/2024
1.4.1 1 08/19/2026
1.4.0 0 01/14/2024
1.3.0-pre 0 01/14/2024
1.2.1 0 07/01/2022
1.2.0 0 06/27/2022
1.1.1 0 06/09/2022
1.1.0 0 05/04/2022
1.0.0 0 04/06/2022
0.0.18-pre 0 02/11/2022
0.0.12-pre 0 12/29/2021
0.0.10-pre 0 12/27/2020
0.0.9-pre 0 12/26/2020
0.0.8-pre 0 12/22/2020
0.0.7-pre 0 12/17/2020
0.0.6-pre 0 10/20/2020
0.0.5-pre 0 10/12/2020
0.0.4-pre 0 09/21/2020
0.0.3-pre 0 09/20/2020
0.0.2-pre 0 09/20/2020
0.0.1-pre 0 09/16/2020