{"id":15086040,"url":"https://github.com/rosenbjerg/ffmpegcore","last_synced_at":"2025-05-12T13:12:59.171Z","repository":{"id":36958073,"uuid":"169710786","full_name":"rosenbjerg/FFMpegCore","owner":"rosenbjerg","description":"A .NET FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your C# applications","archived":false,"fork":false,"pushed_at":"2025-03-05T14:35:45.000Z","size":88050,"stargazers_count":1779,"open_issues_count":65,"forks_count":308,"subscribers_count":38,"default_branch":"main","last_synced_at":"2025-05-12T13:12:45.350Z","etag":null,"topics":["analysis","audio","conversion","ffmpeg","ffprobe","video"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rosenbjerg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-08T09:24:38.000Z","updated_at":"2025-05-07T13:02:03.000Z","dependencies_parsed_at":"2024-06-18T19:47:13.766Z","dependency_job_id":"ba361c30-05b5-4333-a8a7-c31a6e7f9296","html_url":"https://github.com/rosenbjerg/FFMpegCore","commit_stats":{"total_commits":608,"total_committers":58,"mean_commits":"10.482758620689655","dds":0.412828947368421,"last_synced_commit":"eb221c3e49ce6013b164bad0fc88bf0879da95c3"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosenbjerg%2FFFMpegCore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosenbjerg%2FFFMpegCore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosenbjerg%2FFFMpegCore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosenbjerg%2FFFMpegCore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rosenbjerg","download_url":"https://codeload.github.com/rosenbjerg/FFMpegCore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745195,"owners_count":21957319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analysis","audio","conversion","ffmpeg","ffprobe","video"],"created_at":"2024-09-25T07:04:25.791Z","updated_at":"2025-05-12T13:12:59.133Z","avatar_url":"https://github.com/rosenbjerg.png","language":"C#","readme":"# [FFMpegCore](https://www.nuget.org/packages/FFMpegCore/) \n[![NuGet Badge](https://buildstats.info/nuget/FFMpegCore)](https://www.nuget.org/packages/FFMpegCore/)\n[![GitHub issues](https://img.shields.io/github/issues/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/issues)\n[![GitHub stars](https://img.shields.io/github/stars/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/stargazers)\n[![GitHub](https://img.shields.io/github/license/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/blob/master/LICENSE)\n[![CI](https://github.com/rosenbjerg/FFMpegCore/workflows/CI/badge.svg)](https://github.com/rosenbjerg/FFMpegCore/actions/workflows/ci.yml)\n[![GitHub code contributors](https://img.shields.io/github/contributors/rosenbjerg/FFMpegCore)](https://github.com/rosenbjerg/FFMpegCore/graphs/contributors)\n\nA .NET Standard FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your .NET applications. Supports both synchronous and asynchronous calls\n\n# API\n\n## FFProbe\nUse FFProbe to analyze media files:\n\n```csharp\nvar mediaInfo = await FFProbe.AnalyseAsync(inputPath);\n```\nor \n```csharp\nvar mediaInfo = FFProbe.Analyse(inputPath);\n```\n\n## FFMpeg\nUse FFMpeg to convert your media files.\nEasily build your FFMpeg arguments using the fluent argument builder:\n\nConvert input file to h264/aac scaled to 720p w/ faststart, for web playback\n\n```csharp\nFFMpegArguments\n    .FromFileInput(inputPath)\n    .OutputToFile(outputPath, false, options =\u003e options\n        .WithVideoCodec(VideoCodec.LibX264)\n        .WithConstantRateFactor(21)\n        .WithAudioCodec(AudioCodec.Aac)\n        .WithVariableBitrate(4)\n        .WithVideoFilters(filterOptions =\u003e filterOptions\n            .Scale(VideoSize.Hd))\n        .WithFastStart())\n    .ProcessSynchronously();\n```\n\nConvert to and/or from streams\n```csharp\nawait FFMpegArguments\n    .FromPipeInput(new StreamPipeSource(inputStream))\n    .OutputToPipe(new StreamPipeSink(outputStream), options =\u003e options\n        .WithVideoCodec(\"vp9\")\n        .ForceFormat(\"webm\"))\n    .ProcessAsynchronously();\n```\n\n## Helper methods\nThe provided helper methods makes it simple to perform common operations.\n\n### Easily capture snapshots from a video file:\n```csharp\n// process the snapshot in-memory and use the Bitmap directly\nvar bitmap = FFMpeg.Snapshot(inputPath, new Size(200, 400), TimeSpan.FromMinutes(1));\n\n// or persists the image on the drive\nFFMpeg.Snapshot(inputPath, outputPath, new Size(200, 400), TimeSpan.FromMinutes(1));\n```\n\n### You can also capture GIF snapshots from a video file:\n```csharp\nFFMpeg.GifSnapshot(inputPath, outputPath, new Size(200, 400), TimeSpan.FromSeconds(10));\n\n// or async\nawait FFMpeg.GifSnapshotAsync(inputPath, outputPath, new Size(200, 400), TimeSpan.FromSeconds(10));\n\n// you can also supply -1 to either one of Width/Height Size properties if you'd like FFMPEG to resize while maintaining the aspect ratio\nawait FFMpeg.GifSnapshotAsync(inputPath, outputPath, new Size(480, -1), TimeSpan.FromSeconds(10));\n```\n\n### Join video parts into one single file:\n```csharp\nFFMpeg.Join(@\"..\\joined_video.mp4\",\n    @\"..\\part1.mp4\",\n    @\"..\\part2.mp4\",\n    @\"..\\part3.mp4\"\n);\n```\n\n### Create a sub video\n``` csharp\nFFMpeg.SubVideo(inputPath, \n    outputPath,\n    TimeSpan.FromSeconds(0),\n    TimeSpan.FromSeconds(30)\n);\n```\n\n### Join images into a video:\n```csharp\nFFMpeg.JoinImageSequence(@\"..\\joined_video.mp4\", frameRate: 1,\n    ImageInfo.FromPath(@\"..\\1.png\"),\n    ImageInfo.FromPath(@\"..\\2.png\"),\n    ImageInfo.FromPath(@\"..\\3.png\")\n);\n```\n\n### Mute the audio of a video file:\n```csharp\nFFMpeg.Mute(inputPath, outputPath);\n```\n\n### Extract the audio track from a video file:\n```csharp\nFFMpeg.ExtractAudio(inputPath, outputPath);\n```\n\n### Add or replace the audio track of a video file:\n```csharp\nFFMpeg.ReplaceAudio(inputPath, inputAudioPath, outputPath);\n```\n\n### Combine an image with audio file, for youtube or similar platforms\n```csharp\nFFMpeg.PosterWithAudio(inputPath, inputAudioPath, outputPath);\n// or\nvar image = Image.FromFile(inputImagePath);\nimage.AddAudio(inputAudioPath, outputPath);\n```\n\nOther available arguments could be found in `FFMpegCore.Arguments` namespace.\n\n## Input piping\nWith input piping it is possible to write video frames directly from program memory without saving them to jpeg or png and then passing path to input of ffmpeg. This feature also allows for converting video on-the-fly while frames are being generated or received.\n\nAn object implementing the `IPipeSource` interface is used as the source of data. Currently, the `IPipeSource` interface has two implementations; `StreamPipeSource` for streams, and `RawVideoPipeSource` for raw video frames.\n\n### Working with raw video frames\n\nMethod for generating bitmap frames:\n```csharp\nIEnumerable\u003cIVideoFrame\u003e CreateFrames(int count)\n{\n    for(int i = 0; i \u003c count; i++)\n    {\n        yield return GetNextFrame(); //method that generates of receives the next frame\n    }\n}\n```\n\nThen create a `RawVideoPipeSource` that utilises your video frame source\n```csharp\nvar videoFramesSource = new RawVideoPipeSource(CreateFrames(64))\n{\n    FrameRate = 30 //set source frame rate\n};\nawait FFMpegArguments\n    .FromPipeInput(videoFramesSource)\n    .OutputToFile(outputPath, false, options =\u003e options\n        .WithVideoCodec(VideoCodec.LibVpx))\n    .ProcessAsynchronously();\n```\n\nIf you want to use `System.Drawing.Bitmap`s as `IVideoFrame`s, a `BitmapVideoFrameWrapper` wrapper class is provided.\n\n\n# Binaries\n\n## Installation\nIf you prefer to manually download them, visit [ffbinaries](https://ffbinaries.com/downloads) or [zeranoe Windows builds](https://ffmpeg.zeranoe.com/builds/).\n\n### Windows (using choco)\ncommand: `choco install ffmpeg -y`\n\nlocation: `C:\\ProgramData\\chocolatey\\lib\\ffmpeg\\tools\\ffmpeg\\bin`\n\n### Mac OSX\ncommand: `brew install ffmpeg mono-libgdiplus`\n\nlocation: `/usr/local/bin`\n\n### Ubuntu\ncommand: `sudo apt-get install -y ffmpeg libgdiplus`\n\nlocation: `/usr/bin`\n\n\n## Path Configuration\n\n### Option 1\n\nThe default value of an empty string (expecting ffmpeg to be found through PATH) can be overwritten via the `FFOptions` class:\n\n```csharp\n// setting global options\nGlobalFFOptions.Configure(new FFOptions { BinaryFolder = \"./bin\", TemporaryFilesFolder = \"/tmp\" });\n\n// or\nGlobalFFOptions.Configure(options =\u003e options.BinaryFolder = \"./bin\");\n\n// on some systems the absolute path may be required, in which case \nGlobalFFOptions.Configure(new FFOptions { BinaryFolder = Server.MapPath(\"./bin\"), TemporaryFilesFolder = Server.MapPath(\"/tmp\") });\n\n// or individual, per-run options\nawait FFMpegArguments\n    .FromFileInput(inputPath)\n    .OutputToFile(outputPath)\n    .ProcessAsynchronously(true, new FFOptions { BinaryFolder = \"./bin\", TemporaryFilesFolder = \"/tmp\" });\n\n// or combined, setting global defaults and adapting per-run options\nGlobalFFOptions.Configure(new FFOptions { BinaryFolder = \"./bin\", TemporaryFilesFolder = \"./globalTmp\", WorkingDirectory = \"./\" });\n\nawait FFMpegArguments\n    .FromFileInput(inputPath)\n    .OutputToFile(outputPath)\n    .Configure(options =\u003e options.WorkingDirectory = \"./CurrentRunWorkingDir\")\n    .Configure(options =\u003e options.TemporaryFilesFolder = \"./CurrentRunTmpFolder\")\n    .ProcessAsynchronously();\n```\n\n### Option 2\n\nThe root and temp directory for the ffmpeg binaries can be configured via the `ffmpeg.config.json` file, which will be read on first use only.\n\n```json\n{\n  \"BinaryFolder\": \"./bin\",\n  \"TemporaryFilesFolder\": \"/tmp\"\n}\n```\n\n### Supporting both 32 and 64 bit processes\nIf you wish to support multiple client processor architectures, you can do so by creating two folders, `x64` and `x86`, in the `BinaryFolder` directory.\nBoth folders should contain the binaries (`ffmpeg.exe` and `ffprobe.exe`) built for the respective architectures. \n\nBy doing so, the library will attempt to use either `/{BinaryFolder}/{ARCH}/(ffmpeg|ffprobe).exe`.\n\nIf these folders are not defined, it will try to find the binaries in `/{BinaryFolder}/(ffmpeg|ffprobe.exe)`.\n\n(`.exe` is only appended on Windows)\n\n\n# Compatibility\nOlder versions of ffmpeg might not support all ffmpeg arguments available through this library. The library has been tested with version `3.3` to `4.2`\n\n\n## Code contributors\n\u003ca href=\"https://github.com/rosenbjerg/ffmpegcore/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=rosenbjerg/ffmpegcore\" /\u003e\n\u003c/a\u003e\n\n## Other contributors\n\u003ca href=\"https://github.com/tiesont\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/420293?v=4\" title=\"tiesont\" width=\"80\" height=\"80\"\u003e\u003c/a\u003e\n\n\n### License\n\nCopyright © 2023\n\nReleased under [MIT license](https://github.com/rosenbjerg/FFMpegCore/blob/master/LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosenbjerg%2Fffmpegcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosenbjerg%2Fffmpegcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosenbjerg%2Fffmpegcore/lists"}