Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

video format not supported when opening the video created using videowriter

I am creating a video using an image series in a folder which are named as 'image0, image1,...'. But when I try to open the video file created, its not opening. I tried opening it with VLC, media player etc. Am i doing something wrong while creating the VideoWriter object?

//Write video 
VideoWriter ovideoWriter("C:/Users/chandr_m/Desktop/KCF - Copy/MyVideo.avi",CV_FOURCC('M','J','P','G''), 30, 
frameSize);

I take the images as given below:

Mat Image;
do
{
  sequence>>Image;

  if(Image.empty())
     break;
  printf("Write image to video \n");
  Mat imageArr[] = { Image, Image, Image };
  merge(imageArr, 3, imageGrey);

  oVideoWriter.write(imageGrey);
}
while(!Image.empty());