Ask Your Question

Revision history [back]

ViderWriter does not work with fourcc=-1

Hi,

I'm trying to run OpenCV 3.3 under Ubuntu 16.04, compiled from sources using cmake. Here's a simple example program

#include "opencv2/opencv.hpp"

int main() {
  cv::VideoWriter outputVideo;
  int fps = 30;
  int fourcc = 0;
  cv::Size S = cv::Size(1024, 768);
  outputVideo.open("trollz.avi", fourcc, fps, S, true);
  if (!outputVideo.isOpened())  { std::cerr << "Could not open the output video" << std::endl; }

  return(0);
}

When fourcc=0, the program runs and produces an empty movie trollz.avi, as expected.

The tutorial in the documentation, namely,

http://docs.opencv.org/3.3.0/d7/d9e/tutorial_video_write.html

states that, when fourcc=-1, a window must open that would allow the user to select the extension from a list. However, in my case, when fourcc=-1, I get a runtime error:

OpenCV: FFMPEG: tag 0xffffffff/'����' is not found (format 'avi / AVI (Audio Video Interleaved)')'
OpenCV Error: Unsupported format or combination of formats (Gstreamer Opencv backend does not support this codec.) in CvVideoWriter_GStreamer::open, file /home/aleksejs/work/inst/OpenCV/opencv-3.3.0/modules/videoio/src/cap_gstreamer.cpp, line 1522
VIDEOIO(cvCreateVideoWriter_GStreamer (filename, fourcc, fps, frameSize, is_color)): raised OpenCV exception:

/home/aleksejs/work/inst/OpenCV/opencv-3.3.0/modules/videoio/src/cap_gstreamer.cpp:1522: error: (-210) Gstreamer Opencv backend does not support this codec. in function CvVideoWriter_GStreamer::open

Could not open the output video

Please help