7

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.

idish
  • 3,190
  • 12
  • 53
  • 85

1 Answers1

6

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();
Hassan Boutougha
  • 3,871
  • 1
  • 17
  • 17
  • Thank you for your answer, but as I declared before in my post, that library doesn't seem to support transitions and effects, if it does, could you please supply me another code sample? – idish Aug 19 '12 at 08:44
  • see this url for effect and transition http://www.aurigma.com/docs/gm/CreatingTransitionEffects.htm – Hassan Boutougha Aug 19 '12 at 08:52
  • It seems to be just what I'm looking for, but it costs too much.. > – idish Aug 19 '12 at 09:05
  • :) Thank you for you help, last question: I heard that the avifilewriter library is RAM consuming, is it right? – idish Aug 19 '12 at 09:14
  • I don't know but you can workaround in adding little by little your image (a File.ReadAllText on 20GB file is RAM consuming ;-) – Hassan Boutougha Aug 19 '12 at 09:54