title: OpenCV: FFMPEG: tag is not supported with codec id 12 and format 'mp4 / MP4
body: <p>I was trying to run a repo located <a href="https://github.com/Pratik08/Vis-DSS" rel="noreferrer">HERE</a>. Basically, just targeting <code>SimpleVideoSummarizer.cc</code> which uses OpenCV for some basic video processing. I'm using Ubuntu 14.04. Following is the save part of the code:</p>
  
  <pre><code>void SimpleVideoSummarizer::playAndSaveSummaryVideo(char* videoFileSave) {
      cv::VideoCapture capture(videoFile);
      cv::Mat frame;
      capture.set(CV_CAP_PROP_POS_FRAMES, 0);
      cv::VideoWriter videoWriter;
      if (videoFileSave != "") {
          videoWriter = cv::VideoWriter(videoFileSave, CV_FOURCC('M', 'J', 'P', 'G'), static_cast&lt;int&gt;(capture.get(CV_CAP_PROP_FPS)), cv::Size(capture.get(CV_CAP_PROP_FRAME_WIDTH), capture.get(CV_CAP_PROP_FRAME_HEIGHT)));
      }
      for (std::set&lt;int&gt;::iterator it = summarySet.begin(); it != summarySet.end(); it++) {
          capture.set(CV_CAP_PROP_POS_FRAMES, segmentStartTimes[*it] * frameRate);
          for (int i = segmentStartTimes[*it]; i &lt; segmentStartTimes[*it + 1]; i++) {
              for (int j = 0; j &lt; frameRate; j++) {
                  capture &gt;&gt; frame;
                  cv::putText(frame, "Time: " + IntToString(i) + " seconds", cvPoint(30, 30),
                              cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cvScalar(200, 200, 250), 1, CV_AA);
                  if (frame.data) {
                      cv::imshow("Summary Video", frame);
                  }
                  if (videoFileSave != "") {
                      videoWriter.write(frame);
                  }
                  // Press  ESC on keyboard to exit
                  char c = static_cast&lt;char&gt;(cv::waitKey(25));
                  if (c == 27) {
                      break;
                  }
              }
          }
      }
      capture.release();
  }
  </code></pre>
  
  <p>I pass an <code>input.mp4</code> file and specify a <code>out.mp4</code> as well. Unfortunately, when the example is trying to save the output video file, it throws errors on the FOURCC:</p>
  
  <pre><code>OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'
  OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
  </code></pre>
  
  <p>or another one:</p>
  
  <pre><code>OpenCV: FFMPEG: tag 0x3234504d/'MP42' is not supported with codec id 15 and format 'mp4 / MP4 (MPEG-4 Part 14)'
  [mp4 @ 0x16bc700] Could not find tag for codec msmpeg4v2 in stream #0, codec not currently supported in container
  </code></pre>
  
  <p>I tried to change the FOURCC in this part of the code which writes the video, and applied XVID, MJPG, X264, MP42, MP4V. None worked and threw similar errors.</p>
  
  <p><strong>What is the problem? How to fix it?</strong></p>