All Projects → rosenbjerg → Ffmpegcore

rosenbjerg / Ffmpegcore

Licence: mit
A .NET FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your C# applications

Projects that are alternatives of or similar to Ffmpegcore

Mystiq
Qt5/C++ FFmpeg Media Converter
Stars: ✭ 393 (-8.39%)
Mutual labels:  audio, ffmpeg, conversion
Swiftffmpeg
A Swift wrapper for the FFmpeg API
Stars: ✭ 243 (-43.36%)
Mutual labels:  audio, ffmpeg
Fanplayer
A portable video player based on ffmpeg for windows and android platform.
Stars: ✭ 229 (-46.62%)
Mutual labels:  audio, ffmpeg
Audioowl
Fast and simple music and audio analysis using RNN in Python 🕵️‍♀️ 🥁
Stars: ✭ 151 (-64.8%)
Mutual labels:  analysis, audio
Aeneas
aeneas is a Python/C library and a set of tools to automagically synchronize audio and text (aka forced alignment)
Stars: ✭ 1,942 (+352.68%)
Mutual labels:  audio, ffmpeg
Online Video Editor
API based Online Video Editing using FFMPEG & NodeJs for Backend Editing
Stars: ✭ 176 (-58.97%)
Mutual labels:  audio, ffmpeg
Spacextract
Extraction and analysis of telemetry from rocket launch webcasts (from SpaceX and RocketLab)
Stars: ✭ 131 (-69.46%)
Mutual labels:  analysis, ffmpeg
Sonos Web
Web interface for Sonos audio systems
Stars: ✭ 114 (-73.43%)
Mutual labels:  audio, ffmpeg
eloquent-ffmpeg
High-level API for FFmpeg's Command Line Tools
Stars: ✭ 71 (-83.45%)
Mutual labels:  ffmpeg, conversion
Youtube Audio Stream
youtube audio stream
Stars: ✭ 276 (-35.66%)
Mutual labels:  audio, ffmpeg
Androidffmpeg
android 读取摄像头和麦克风,使用rtmp推流
Stars: ✭ 298 (-30.54%)
Mutual labels:  audio, ffmpeg
Ffmpeg Video Player
An FFmpeg and SDL Tutorial.
Stars: ✭ 149 (-65.27%)
Mutual labels:  audio, ffmpeg
Digital video introduction
A hands-on introduction to video technology: image, video, codec (av1, vp9, h265) and more (ffmpeg encoding).
Stars: ✭ 12,184 (+2740.09%)
Mutual labels:  audio, ffmpeg
Mpv
🎥 Command line video player
Stars: ✭ 17,018 (+3866.9%)
Mutual labels:  audio, ffmpeg
Prism Media
Easily transcode media using Node.js 🎶
Stars: ✭ 136 (-68.3%)
Mutual labels:  audio, ffmpeg
Yuview
The Free and Open Source Cross Platform YUV Viewer with an advanced analytics toolset
Stars: ✭ 665 (+55.01%)
Mutual labels:  analysis, ffmpeg
Aurio
Audio Fingerprinting & Retrieval for .NET
Stars: ✭ 84 (-80.42%)
Mutual labels:  audio, ffmpeg
Soundpusher
Virtual audio device, real-time encoder and SPDIF forwarder for macOS
Stars: ✭ 91 (-78.79%)
Mutual labels:  audio, ffmpeg
Aubio
a library for audio and music analysis
Stars: ✭ 2,601 (+506.29%)
Mutual labels:  analysis, audio
Mpc Hc
MPC-HC's main repository. For support use our Trac: https://trac.mpc-hc.org/
Stars: ✭ 3,567 (+731.47%)
Mutual labels:  audio, ffmpeg

FFMpegCore

CI NuGet Badge GitHub issues GitHub stars GitHub

Setup

NuGet:

Install-Package FFMpegCore

A .NET Standard FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your C# applications. Support both synchronous and asynchronous use

API

FFProbe

FFProbe is used to gather media information:

var mediaInfo = FFProbe.Analyse(inputPath);

or

var mediaInfo = await FFProbe.AnalyseAsync(inputPath);

FFMpeg

FFMpeg is used for converting your media files to web ready formats. Easily build your FFMpeg arguments using the fluent argument builder:

Convert input file to h264/aac scaled to 720p w/ faststart, for web playback

FFMpegArguments
    .FromFileInput(inputPath)
    .OutputToFile(outputPath, false, options => options
        .WithVideoCodec(VideoCodec.LibX264)
        .WithConstantRateFactor(21)
        .WithAudioCodec(AudioCodec.Aac)
        .WithVariableBitrate(4)
        .WithVideoFilters(filterOptions => filterOptions
            .Scale(VideoSize.Hd))
        .WithFastStart())
    .ProcessSynchronously();

Easily capture screens from your videos:

// process the snapshot in-memory and use the Bitmap directly
var bitmap = FFMpeg.Snapshot(inputPath, new Size(200, 400), TimeSpan.FromMinutes(1));

// or persists the image on the drive
FFMpeg.Snapshot(inputPath, outputPath, new Size(200, 400), TimeSpan.FromMinutes(1));

Convert to and/or from streams

await FFMpegArguments
    .FromPipeInput(new StreamPipeSource(inputStream))
    .OutputToPipe(new StreamPipeSink(outputStream), options => options
        .WithVideoCodec("vp9")
        .ForceFormat("webm"))
    .ProcessAsynchronously();

Join video parts into one single file:

FFMpeg.Join(@"..\joined_video.mp4",
    @"..\part1.mp4",
    @"..\part2.mp4",
    @"..\part3.mp4"
);

Join images into a video:

FFMpeg.JoinImageSequence(@"..\joined_video.mp4", frameRate: 1,
    ImageInfo.FromPath(@"..\1.png"),
    ImageInfo.FromPath(@"..\2.png"),
    ImageInfo.FromPath(@"..\3.png")
);

Mute videos:

FFMpeg.Mute(inputPath, outputPath);

Save audio track from video:

FFMpeg.ExtractAudio(inputPath, outputPath);

Add or replace audio track on video:

FFMpeg.ReplaceAudio(inputPath, inputAudioPath, outputPath);

Add poster image to audio file (good for youtube videos):

FFMpeg.PosterWithAudio(inputPath, inputAudioPath, outputPath);
// or
var image = Image.FromFile(inputImagePath);
image.AddAudio(inputAudioPath, outputPath);

Other available arguments could be found in FFMpegCore.Arguments namespace.

Input piping

With 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 us to convert video on-the-fly while frames are being generated or received.

The IPipeSource interface is used as the source of data. It could be represented as encoded video stream or raw frames stream. Currently, the IPipeSource interface has single implementation, RawVideoPipeSource that is used for raw stream encoding.

For example:

Method that is generating bitmap frames:

IEnumerable<IVideoFrame> CreateFrames(int count)
{
    for(int i = 0; i < count; i++)
    {
        yield return GetNextFrame(); //method of generating new frames
    }
}

Then create ArgumentsContainer with InputPipeArgument

var videoFramesSource = new RawVideoPipeSource(CreateFrames(64)) //pass IEnumerable<IVideoFrame> or IEnumerator<IVideoFrame> to constructor of RawVideoPipeSource
{
    FrameRate = 30 //set source frame rate
};
await FFMpegArguments
    .FromPipeInput(videoFramesSource)
    .OutputToFile(outputPath, false, options => options
        .WithVideoCodec(VideoCodec.LibVpx))
    .ProcessAsynchronously();

if you want to use System.Drawing.Bitmap as IVideoFrame, there is a BitmapVideoFrameWrapper wrapper class.

Binaries

If you prefer to manually download them, visit ffbinaries or zeranoe Windows builds.

Windows

command: choco install ffmpeg -Y

location: C:\ProgramData\chocolatey\lib\ffmpeg\tools\ffmpeg\bin

Mac OSX

command: brew install ffmpeg mono-libgdiplus

location: /usr/local/bin

Ubuntu

command: sudo apt-get install -y ffmpeg libgdiplus

location: /usr/bin

Path Configuration

Behavior

If you wish to support multiple client processor architectures, you can do so by creating a folder x64 and x86 in the root directory. Both folders should contain the binaries (ffmpeg.exe and ffprobe.exe) for build for the respective architectures.

By doing so, the library will attempt to use either /root/{ARCH}/(ffmpeg|ffprobe).exe.

If these folders are not defined, it will try to find the binaries in /root/(ffmpeg|ffprobe.exe)

Option 1

The default value of an empty string (expecting ffmpeg to be found through PATH) can be overwritten via the FFOptions class:

// setting global options
GlobalFFOptions.Configure(new FFOptions { BinaryFolder = "./bin", TemporaryFilesFolder = "/tmp" });
// or
GlobalFFOptions.Configure(options => options.BinaryFolder = "./bin");

// or individual, per-run options
await FFMpegArguments
    .FromFileInput(inputPath)
    .OutputToFile(outputPath)
    .ProcessAsynchronously(true, new FFOptions { BinaryFolder = "./bin", TemporaryFilesFolder = "/tmp" });

Option 2

The root and temp directory for the ffmpeg binaries can be configured via the ffmpeg.config.json file.

{
  "BinaryFolder": "./bin",
  "TemporaryFilesFolder": "/tmp"
}

Compatibility

Some versions of FFMPEG might not have the same argument schema. The lib has been tested with version 3.3 to 4.2

Contributors

License

Copyright © 2021

Released under MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].