Mariusmssj4
Posts: 15
Joined: Thu Jan 23, 2014 10:37 am

Raspbery PI video codecs OpenCV

Tue May 12, 2015 3:14 pm

Hello guys,

I am trying to convert a bunch of images into a video, I got OpenCV code working perfectly fine on the Windows machine but videos I make on windows machine doesn't seem to work on pi using opencv. So I thought I'll just run the same code on pi and encode the images on the pi itself. The issue that I am getting is seems that OpenCV can't detect a single video codec.
Here is my code:

Code: Select all

#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;

int main()
{
	const int totalImages = 180;
	const char* depthDatasetPath("W:/Tsukuba/groundtruth/disparity_maps/right");

	string filename = "W:/Tsukuba/videos/test3.avi";
	//int codec = CV_FOURCC('F', 'M', 'P', '4'); // use MP4 as video codec
	VideoWriter writer(filename, -1, 30, Size(640, 480), true); // -1 show menu to choose codec

	for (int i = 1; i < totalImages; i++)
	{
		Mat img = cv::imread(format("%s/tsukuba_disparity_R_%05d.png", depthDatasetPath, i), CV_LOAD_IMAGE_GRAYSCALE);

		writer.write(img);
		if (waitKey(1) >= 0)
			break;
	}
	writer.release();
}
How to check what video codecs pi has and am I doing something wrong?

Thanks :)

johnflan
Posts: 1
Joined: Wed Oct 28, 2015 11:15 pm

Re: Raspbery PI video codecs OpenCV

Wed Oct 28, 2015 11:18 pm

The issue that I am getting is seems that OpenCV can't detect a single video codec.
How do you know you can't detect any codec's - what errors are you getting? Have you tried 'X','V','I','D' or 'X','2','6','4'?

Return to “C/C++”