FFmpeg.Rx 0.1.2

dotnet add package FFmpeg.Rx --version 0.1.2
                    
NuGet\Install-Package FFmpeg.Rx -Version 0.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FFmpeg.Rx" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FFmpeg.Rx" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="FFmpeg.Rx" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FFmpeg.Rx --version 0.1.2
                    
#r "nuget: FFmpeg.Rx, 0.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FFmpeg.Rx@0.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FFmpeg.Rx&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=FFmpeg.Rx&version=0.1.2
                    
Install as a Cake Tool

FFmpeg.Rx

NuGet NuGet Downloads License: MIT Dotnet

Reactive FFmpeg process wrapper using R3 Observables. Type-safe, composable, testable.


Why FFmpeg.Rx?

Most .NET FFmpeg wrappers pass encoding options as raw strings - codec names, bitrate values, filter expressions. Typos compile fine and fail at runtime. FFmpeg.Rx replaces string bags with typed records: every codec, bitrate, preset, pixel format, and container is a .NET type with static factories and a Custom() escape hatch. The pipeline is a record tree you can inspect, test, and serialize - builders are syntactic sugar on top.

Events (progress, log, lifecycle) come as R3 Observables, not callbacks. One session wraps one process. Build → Run → Done.


Features

  • Typed pipeline model - codecs, bitrates, presets, formats as .NET types, not strings
  • Disjoint codec specs - StreamCopy | VideoEncode | AudioEncode | SubtitleEncode at compile time
  • R3 Observables - progress, log, and lifecycle events as reactive streams
  • ffprobe integration - strongly-typed MediaInfo with AOT-compatible JSON
  • Convenience APIs - snapshots, concatenation, pipe I/O
  • Escape hatches - CustomArg() on every builder, Custom() on every value object
  • Mockable - IFfmpegSession for consumer tests

Installation

dotnet add package FFmpeg.Rx

Requires ffmpeg on PATH (or provide a custom binary path via Ffmpeg.At(path)).

Requirements: .NET 10.0 or higher

Quick Start

using FFmpeg.Rx;
using FFmpeg.Rx.Codecs;

// Transcode with H264 + AAC
await using var session = Ffmpeg.Input("input.mp4")
    .Output("output.mp4", o => o
        .Stream(0, 0, StreamType.Video, s => s
            .Encode(VideoCodec.H264, e => e
                .Quality(Quality.Crf(23))
                .Preset(Preset.Slow)))
        .Stream(0, 0, StreamType.Audio, s => s
            .Encode(AudioCodec.Aac, e => e
                .Bitrate(Bitrate.Kbps(192)))));

var result = await session.RunAsync();

Stream Copy (Remux)

await using var session = Ffmpeg.Input("input.mp4")
    .Output("output.mkv", o => o
        .Stream(0, 0, StreamType.Video, s => s.Copy())
        .Stream(0, 0, StreamType.Audio, s => s.Copy()));

await session.RunAsync();

Progress Events

await using var session = Ffmpeg.Input("input.mp4")
    .WithProgressReporting()
    .Output("output.mp4", o => o
        .Stream(0, 0, StreamType.Video, s => s
            .Encode(VideoCodec.H264, e => e.Quality(Quality.Crf(23)))));

session.Progress.Subscribe(p =>
    Console.WriteLine($"Speed: {p.Speed:F1}x, Written: {p.BytesWritten} bytes"));

session.Log.Subscribe(log =>
    Console.WriteLine($"[{log.Level}] {log.Line}"));

var result = await session.RunAsync();

Filters

await using var session = Ffmpeg.Input("input.mp4")
    .Output("scaled.mp4", o => o
        .Stream(0, 0, StreamType.Video, s => s
            .Encode(VideoCodec.H264, e => e.Quality(Quality.Crf(23))))
        .VideoFilter(f => f.Scale(1920, 1080)));

await session.RunAsync();

Probing

var info = await Ffmpeg.Probe("video.mp4");

Console.WriteLine($"Duration: {info.Duration}");
Console.WriteLine($"Video: {info.PrimaryVideo?.Codec} {info.PrimaryVideo?.Width}x{info.PrimaryVideo?.Height}");
Console.WriteLine($"Audio: {info.PrimaryAudio?.Codec} {info.PrimaryAudio?.SampleRate}Hz");

Snapshots and Concat

// Extract a single frame
await Ffmpeg.Snapshot("video.mp4", TimeSpan.FromSeconds(5), "thumb.jpg");

// Concatenate videos (same codec)
await Ffmpeg.Concat(["part1.mp4", "part2.mp4"], "full.mp4");

Custom Binary Path

await using var session = Ffmpeg.At("/usr/local/bin/ffmpeg")
    .Input("input.mp4")
    .Output("output.mp4", o => o
        .Stream(0, 0, StreamType.Video, s => s.Copy())
        .Stream(0, 0, StreamType.Audio, s => s.Copy()));

Architecture

Three-layer design - each layer is independently testable:

Layer 1: Pipeline records     what the user wants    PipelineConfig, OutputConfig, CodecConfig...
                              (immutable, inspectable, serializable)
                                        |
Layer 2: Scoped builders      how the user says it   PipelineBuilder, OutputBuilder, StreamBuilder...
                              (fluent API sugar)
                                        |
Layer 3: Serializer + CliWrap how it gets done        ArgumentSerializer → CliWrap process execution
                              (pattern-match records → CLI args → run)

Core types:

Type Role
PipelineConfig Root record: inputs + outputs + global options
InputConfig Abstract: FileInput, UrlInput, PipeInput
OutputConfig Destination, streams, container, filters, metadata
CodecConfig StreamCopy | VideoEncode | AudioEncode | SubtitleEncode
IFfmpegSession Consumer-facing interface (mockable)
FfmpegSession CliWrap execution, R3 event bridging

Building from Source

dotnet build src/FFmpeg.Rx.slnx
dotnet format src/FFmpeg.Rx.slnx --verify-no-changes
dotnet run --project src/FFmpeg.Rx.Tests/FFmpeg.Rx.Tests.csproj
dotnet run --project src/FFmpeg.Rx.IntegrationTests/FFmpeg.Rx.IntegrationTests.csproj

Contributing

Contributions are welcome. Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Write tests for your changes
  4. Ensure all tests pass and dotnet format is clean
  5. Submit a Pull Request

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • CliWrap (>= 3.10.5 && < 4.0.0)
    • R3 (>= 1.2.9)

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 95 12/3/2026
0.1.1 372 11/9/2026
0.1.0 109 11/8/2026