Ask Your Question
0

Create VP09 video - writer not open

asked Apr 18 '17

Pavla gravatar image

updated Apr 20 '17

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.

Preview: (hide)

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 (Apr 18 '17)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 (Apr 19 '17)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 (Apr 19 '17)edit

1 answer

Sort by » oldest newest most voted
0

answered May 22 '0

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.

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Apr 18 '17

Seen: 2,949 times

Last updated: May 21 '20