EggEncoder 0.1.0
See the version list below for details.
dotnet add package EggEncoder --version 0.1.0
NuGet\Install-Package EggEncoder -Version 0.1.0
<PackageReference Include="EggEncoder" Version="0.1.0" />
<PackageVersion Include="EggEncoder" Version="0.1.0" />
<PackageReference Include="EggEncoder" />
paket add EggEncoder --version 0.1.0
#r "nuget: EggEncoder, 0.1.0"
#:package EggEncoder@0.1.0
#addin nuget:?package=EggEncoder&version=0.1.0
#tool nuget:?package=EggEncoder&version=0.1.0
π₯ EggEncoder
Audio encoding/decoding toolkit for .NET β native MP3/FLAC codec bindings, managed AAC/WMA decode, waveform generation, and an ffmpeg wrapper fallback, all behind one
IMediaEncoderinterface.
Sponsored by eggspot.app
Overview
EggEncoder gives you a single IMediaEncoder abstraction for probing, converting, and cutting audio files, backed by two interchangeable implementations:
NativeEncoderβ pure .NET codec implementations (AAC, FLAC, MP3, WAV, WMA) plus native P/Invoke bindings tolibmp3lameandlibFLAC. No external process, no ffmpeg install required, fastest option on Windows x64.FfmpegEncoderβ shells out to anffmpeg/ffprobebinary you provide. Broader format support (including video container probing via MOV/MP4), useful when you need formats the native codecs don't cover.
Both implementations return the same ProbeResult shape (duration, sample rate, bit depth, bitrate, waveform peaks) so callers can switch between them via configuration without touching call sites.
Why EggEncoder?
- π― One interface, two engines β swap native β ffmpeg via a single config flag
- π Native codec bindings β direct P/Invoke to LAME (MP3) and libFLAC, no subprocess overhead
- πΌ Broad format coverage β AAC, FLAC, MP3, WAV, WMA decode/encode; MOV/MP4 metadata probing
- π Built-in waveform generation β normalized peak windows for any decoded stream
- βοΈ Sample-accurate cutting β trim audio files without a full decodeβencode round trip through ffmpeg
- πͺΆ Dependency-light β only
Microsoft.Extensions.*.AbstractionsandNLayer - π MIT licensed β see THIRD-PARTY-NOTICES.md for the bundled native codec licenses (LGPL-2.1 LAME, BSD-style libFLAC)
Installation
dotnet add package EggEncoder
Native codec binaries (libmp3lame.dll, libFLAC.dll) ship inside the package for win-x64 and are copied to your output directory automatically.
Quick Start
using EggEncoder;
// Dependency injection (recommended)
builder.Services.AddEggEncoder(options =>
{
options.UseNativeEncoder = true; // or false to use ffmpeg
// options.FfmpegBinPath = @"C:\tools\ffmpeg"; // required when UseNativeEncoder = false
});
public class MediaService(IMediaEncoder mediaEncoder)
{
public async Task<ProbeResult> Inspect(string filePath) =>
await mediaEncoder.Probe(filePath);
public Task Transcode(string sourcePath, string destPath) =>
mediaEncoder.ConvertFile(sourcePath, destPath);
public Task Trim(string sourcePath, string destPath, int startSeconds, int endSeconds) =>
mediaEncoder.CutFile(sourcePath, destPath, startSeconds, endSeconds);
}
Without DI
using EggEncoder;
using Microsoft.Extensions.Logging.Abstractions;
IMediaEncoder encoder = new NativeEncoder(NullLogger<NativeEncoder>.Instance);
var probeResult = await encoder.Probe("track.flac");
Supported Formats
| Format | Native probe | Native decode | Native encode | ffmpeg |
|---|---|---|---|---|
| WAV | β | β | β | β |
| FLAC | β | β | β | β |
| MP3 | β | β | β | β |
| AAC | β | β | β | β |
| WMA | β | β | β | β |
| MOV/MP4 (metadata only) | β | β | β | β |
NativeEncoder.CutFile supports WAV, FLAC, MP3, and AAC (sample-accurate, no re-encode of the untouched region). FfmpegEncoder supports whatever your ffmpeg build supports.
Configuration
EggEncoderOptions:
| Property | Type | Description |
|---|---|---|
UseNativeEncoder |
bool |
true resolves IMediaEncoder as NativeEncoder; false resolves FfmpegEncoder. Default false. |
FfmpegBinPath |
string? |
Directory containing ffmpeg.exe and ffprobe.exe. Required when UseNativeEncoder is false. FfmpegEncoderBinFactory throws FileNotFoundException at startup if either binary is missing β EggEncoder does not download or provision ffmpeg for you. |
License
MIT β see LICENSE. EggEncoder bundles pre-built libmp3lame.dll (LGPL-2.1) and
libFLAC.dll (BSD-style) as separate, dynamically-loaded native binaries; see
THIRD-PARTY-NOTICES.md for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- NLayer (>= 2.0.1)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- NLayer (>= 2.0.1)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- NLayer (>= 2.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.