Skip to content

Repository files navigation

VideoCutter

.NET C%23 FFmpeg

VideoCutter is a .NET console application that splits a video into segments and processes them in parallel through an FFmpeg pipeline.

The project is primarily an exercise in asynchronous programming, external process execution, dependency injection, event-driven UI updates, and layered application architecture.

Features

  • splits a source video into fixed-duration segments;
  • applies a configurable processing pipeline to every segment;
  • supports the Resize filter;
  • reads processing settings from JSON;
  • supports cancellation with Ctrl+C and CancellationToken;
  • includes a fake command executor for testing the processing flow without writing output videos.

Tech stack

  • C# and .NET 9
  • FFmpeg and FFMpegCore
  • Microsoft.Extensions.DependencyInjection
  • System.Text.Json
  • System.Threading.Channels

Architecture

The solution is divided into five projects:

VideoCutter/
├── Domain/          # processing definitions, filters, commands, and value objects
├── Application/     # configuration contracts, use cases, engine, and processing events
├── Infrastructure/  # JSON, FFmpeg, file-system, and console implementations
├── Presentation/    # UI components, event dispatcher, and rendering contracts
├── VideoCutter/     # composition root, DI registrations, and coordinator
└── VideoCutter.sln

Requirements

  • .NET 9 SDK
  • ffmpeg and ffprobe available through PATH, or the FFmpeg binaries placed under VideoCutter/Tools in the directory layout expected by Program.cs

The current composition root uses FakeCommandExecutor, so FFmpeg commands are built and the input metadata is read, but output video segments are not written. To enable real processing, replace services.AddFakeProcessing() with services.AddFFmpegProcessing() in VideoCutter/Program.cs.

Configuration

Edit VideoCutter/config.json before running the application:

{
  "info": {
    "inputFilePath": "C:\\Videos\\input.mp4",
    "outputFolderPath": "C:\\Videos\\Output"
  },
  "segmentation": {
    "chunkDuration": "00:00:20",
    "offset": "00:00:00"
  },
  "pipelineDefinition": {
    "steps": [
      {
        "type": "Resize",
        "parameters": {
          "width": "1080",
          "height": "1920"
        }
      }
    ]
  }
}

Configuration fields:

Field Description
info.inputFilePath Path to the source video.
info.outputFolderPath Directory for processed segments.
segmentation.chunkDuration Target duration of each segment.
segmentation.offset Position in the source video where processing starts.
pipelineDefinition.steps Ordered list of filters applied to every segment.

The Resize filter requires positive integer width and height parameters.

Run

git clone https://github.com/BISCUITIC/VideoCutter.git
cd VideoCutter
dotnet restore
dotnet run --project VideoCutter/VideoCutter.csproj

Press Ctrl+C to cancel processing gracefully.

Screenshots

Processing screen

Processing screen

Processing result

Video before processing
Before processing
Video after processing
After processing

Current limitations

  • only the Resize pipeline step is implemented;
  • switching between the fake and real command executors requires changing the DI registration in Program.cs;

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages