Ask Your Question
1

VideoWriter output using VP8 not working

asked 2013-08-05 05:38:42 -0600

Garret Raziel gravatar image

Hi, I'm using OpenCV with python bindings and I want to use VideoWriter with webm output, I am using VP8 codec. It creates VideoWriter correctly and without an error. It creates output file and it puts information about resolution in it, but when I write image into it, it doesn't do anything and output file is always only 7 KiB. I have also tried it in C++ with the same result.

I am using Fedora 19, 64bit. I have added RPM Fusion repos and tried to install every gstreamer plugin, ffmpeg and everything that popped out when I searched "VP8". I also tried it in Ubuntu 13.04 with the same result. I rather think that this is a bug, because when I tried to use different codec (xvid), it worked. Try it with this C++ code:

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;

int main(int, char **) {
    VideoCapture capture(0);

    Mat frame;
    capture >> frame;

    cout << frame.size() << endl;
    VideoWriter record("out.webm", CV_FOURCC('V', 'P', '8', '0'), 30, frame.size(), true);

    namedWindow("video", 1);

    for (;;) {
        capture >> frame;
        imshow("video", frame);
        record << frame;
        if (waitKey(30) >= 0) break;
    }

    return 0;
}

or this simple python program:

import cv2
from numpy import *

a = zeros((768, 1024, 3), dtype=uint8)
b = ones((768, 1024, 3), dtype=uint8)
vw = cv2.VideoWriter("out.webm", cv2.cv.CV_FOURCC(*"VP80"), 24, (1024, 768), True)

for i in xrange(256):
    vw.write(a)
    a = a + b

I am using OpenCV 2.4.5.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-01-28 16:46:12 -0600

Rodrigo Uroz gravatar image

I'm trying to do the same. Did you manage to make this work?

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-08-05 05:38:42 -0600

Seen: 3,386 times

Last updated: Jan 28 '14