dimanche 12 avril 2015

Reversed bitmap when creating AVI container

I have a list of images in my program, and I am generating an AVI video from them. For that purpose I use avifilewrapper_src library that handles the creation of video. The proces of creating is:



Bitmap bitmap;
//load the first image
bitmap = (Bitmap)imageSequence[0];

//create a new AVI file
AviManager aviManager = new AviManager(paths.outputVideo, false);
//add a new video stream and one frame to the new file
VideoStream aviStream = aviManager.AddVideoStream(true, (double)nud_picturePerSec.Value, bitmap);

if(chb_audio.Checked)
aviManager.AddAudioStream(paths.sampleAudio, 0);


int count = 0;
for (int n = 0; n < imageSequence.Count; n++) {
bitmap = (Bitmap)imageSequence[n];
aviStream.AddFrame(bitmap);
bitmap.Dispose();
count++;
}

aviManager.Close();


If I keep giving different images, it works fine. If I however, put two similar images, than the video shows second image upside down (left/right side is correct). By two similar images i mean creating second image and copying it from the first one.


I have a feeling that this is somehow related to streams, but I can't find why are the images inverted.


Aucun commentaire:

Enregistrer un commentaire