Skip to main content

AVI output

AVI sink is used to create AVI files, and it is popular among Windows users. AVI files support many different video, audio, and subtitle formats.

Use the AVISinkSettings class to set the parameters.

Block info

Name: AVISinkBlock.

Pin directionMedia typePins count
Input audioaudio/x-rawone or more
audio/mpeg
audio/x-ac3
audio/x-alaw
audio/x-mulaw
audio/x-wma
Input videovideo/x-rawone or more
image/jpeg
video/x-divx
video/x-msmpeg
video/mpeg
video/x-h263
video/x-h264
video/x-dv
video/x-huffyuv
video/x-wmv
video/x-jpc
video/x-vp8
image/png

The sample pipeline

Sample code

var pipeline = new MediaBlocksPipeline();

var filename = "test.mp4";
var fileSource = new UniversalSourceBlock(await UniversalSourceSettings.CreateAsync(new Uri(filename)));

var mp3EncoderBlock = new MP3EncoderBlock(new MP3EncoderSettings() { Bitrate = 192 });
pipeline.Connect(fileSource.AudioOutput, mp3EncoderBlock.Input);

var h264EncoderBlock = new H264EncoderBlock(new MFH264EncoderSettings());
pipeline.Connect(fileSource.VideoOutput, h264EncoderBlock.Input);

var aviSinkBlock = new AVISinkBlock(new AVISinkSettings(@"output.avi"));
pipeline.Connect(h264EncoderBlock.Output, aviSinkBlock.CreateNewInput(MediaBlockPadMediaType.Video));
pipeline.Connect(mp3EncoderBlock.Output, aviSinkBlock.CreateNewInput(MediaBlockPadMediaType.Audio));

await pipeline.StartAsync();

Platforms

Windows, macOS, Linux, iOS, Android.