Ask Your Question

Create VP09 video - writer not open

asked 2017-04-18 08:23:38 -0500

Pavla gravatar image

updated 2017-04-20 02:43:05 -0500

Hi all,

I need to create video using the VP09 (or VP08) codec, but when I pass this configuration to VideoWriter, it newer open created file.

I tried to change output video format from "avi" to "mp4", but nothing happens. Uncompressed video (fourcc argument replaced by 0) works fine.

I'm using C++ and openCV as a library, running Windows 10 and Visual Studio 2015.

Any idea whot can be wrong?


My code:

#include "opencv2\core\cvdef.h"
#include "opencv2\core.hpp"
#include "opencv2\videoio.hpp"

cv::VideoWriter *outputVideo;
cv::Size S = cv::Size(width, height);
int fps = 10;
cv::String name = "C:\\Users\\pavlak\\Desktop\\movie.avi";

outputVideo = new cv::VideoWriter(name, cv::VideoWriter::fourcc('V', 'P', '0', '9'), fps, S, true);
if (outputVideo->isOpened()){
     // newer gets there


  • ffmpeg added to app run folder (thanks berak) - using opencv_ffmpeg310_64.dll, according to short opencv code tracing loaded correctly, at least icvCreateVideoWriter_FFMPEG_p is not null
  • switch to VP8 (listed on FOURCC codec list as VP80)
  • tried to use webm, avi, mkv, mp4

But still no success. I 'll be gratefull for any other hints.

I'm limited by codecs because of comercial app and VP's should be usefull for this. For now I'm using the built-in MJPG, which works fine with avi container (just two hard gained hints: it needs 8bit picture and color set to true, otherwise won't work). But I'm still open for solution for VP's.

edit retag flag offensive close merge delete


  • make sure, opencv_ffmpeg320.dll is on the path (or next to your app)
  • try to choose a less exotic codec (i couldn't get it to write something useful with any container i tried)
berak gravatar imageberak ( 2017-04-18 09:36:08 -0500 )edit

Its not because the codec is on the fourcc website, that OpenCV or your OS actually supports it. There is only a limited set of codecs that actually work decently in OpenCV, and they have to be combined with the correct container. Some suggestions of codecs that have been proved to work can be found here.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-04-19 05:00:11 -0500 )edit

it says here, that matroska (e.g. webm) and mp4 (but not avi) should be supported for vp09, but none of them produces a working result

berak gravatar imageberak ( 2017-04-19 06:23:15 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-05-21 23:47:17 -0500

meathead2k2 gravatar image

I know this is really old but if anyone is interested I believe there is an issue with OpenCV and codecs if you have used a prebuilt version of opencv from pip or conda.

My solution is to use the XVID codec and then convert with a shell command after VideoWriter has finished.

Not elegant but it gets you the file type you desired.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-04-18 08:23:38 -0500

Seen: 1,129 times

Last updated: May 21