video format not supported when opening the video created using videowriter

asked 2018-10-10 08:41:53 -0600

meera_c gravatar image

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());
edit retag flag offensive close merge delete

Comments

that's not enough code, to validate your approach.

please also check the return value of oVideoWriter.write (did the framesize match ?)

berak gravatar imageberak ( 2018-10-10 09:29:55 -0600 )edit