Creating a video out of a set of images

idish picture idish · Aug 19, 2012 · Viewed 8.7k times · Source

I've been looking much time for creating a video(.avi file) from images using a C# code,

Is there any library that maintain the video creating? I've been looking through AviFileWriter library, but that library seems to be too fixed since I need to add some transitions and other elements.

So how can I fulfill my needs using C#? I wouldn't care if the coding is complex abit.

Answer

Hassan Boutougha picture Hassan Boutougha · Aug 19, 2012

here a c# project with main AVI function http://www.codeproject.com/Articles/7388/A-Simple-C-Wrapper-for-the-AviFile-Library

here use of VideoStream to create a video making frames from bmp file

 //load the first image
Bitmap bitmap = (Bitmap)Image.FromFile(txtFileNames.Lines[0]);
//create a new AVI file
AviManager aviManager = 
    new AviManager(@"..\..\testdata\new.avi", false);
//add a new video stream and one frame to the new file
VideoStream aviStream = 
    aviManager.AddVideoStream(true, 2, bitmap);

Bitmap bitmap;
int count = 0;
for(int n=1; n<txtFileNames.Lines.Length; n++){
    if(txtFileNames.Lines[n].Trim().Length > 0){
        bitmap = 
           (Bitmap)Bitmap.FromFile(txtFileNames.Lines[n]);
        aviStream.AddFrame(bitmap);
        bitmap.Dispose();
        count++;
    }
}
aviManager.Close();