Giter Club home page Giter Club logo

csvideo's Introduction

CSVideo

CSVideo is a C# Library for writing video files using FFmpeg.

I was searching for a good C# video writing library for a long time, and the only one that could output a modern formats (H264 etc.) was Accord.FFmpeg. The framework however requires a lot of extra libraries, and the video file writer is glitchy and does not work with audio.

This project aims to provide a lightweight and easy-to-use FFmpeg video writing library without any of these problems.

Design

One of the design goals for this library is an easy-to-use API. Part of this is not only a simple set of exposed functions, but also the chosen default configuration. In contrast to libraries like Accord, the default configuration for this library outputs high-quality audio and video in 1920x1080 resolution. However, you can also change the configuration to your liking, if you want something more special.

Usage

To use this library, you need the FFmpeg library files. I tested it with the libraries supplied by FFmpeg.AutoGen (v4.2), which you can download from here, but you can also try the latest version from the FFmpeg site. Once you have these libraries, you can use CSVideo as follows:

FFmpegLoader.Load(@"C:\the\ffmpeg\folder");

using (var writer = new VideoWriter(OutputPath))
{
	writer.Open();
	while (true)
	{
		if (writer.WriteVideo)
		{
			// Write a video frame
			writer.WriteVideoFrame(bitmap);
		}
		else
		{
			// Write an audio frame
			writer.WriteAudioFrame(audioData);
		}
	}
}

For a more complete example, see the CSVideo.Example project.

Audio Support

Supports mono and stereo floating-point audio samples, for example from a CSCore stream. The default is stereo, so for mono streams you have to set writer.Channels = 1. It only supports mono and stereo, any different number of channels will lead to an exception

Credits

Thanks to FFmpeg.AutoGen by Ruslan-B for the very nice C# FFmpeg wrapper

Contributing

You can help me make CSVideo the go-to solution for video manipulation in C# by reporting bugs in the GitHub issue tracker, or submitting pull requests. I appreciate every improvement to this repository.

csvideo's People

Contributors

twometer avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.