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?

Thanks

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
}

Update:

  • 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

Comments

1
  • 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