Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
opencv videowriter bug check cling
.L ./lib/libopencv_videoio.dylib
.L ./lib/libopencv_highgui.dylib
//.L /usr/local/Cellar/opencv/3.3.0_3/lib/libopencv_highgui.3.3.0.dylib
//.L /usr/local/Cellar/opencv/3.3.0_3/lib/libopencv_videoio.3.3.0.dylib
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
#include <math.h>
#include <iostream>
cv::Mat img(100, 100, CV_8UC3);
cv::randu(img, cv::Scalar(0, 0, 0), cv::Scalar(255, 255, 255));
auto fvc1 = CV_FOURCC('F','F','V','1'); // CV_FOURCC('F','F','V','1');
auto vw = cv::VideoWriter("out.avi",fvc1,30,cv::Size(100,100));
auto vc = cv::VideoCapture("out.avi");
cv::Mat img2(100,100,CV_8UC3);
vc >> img2;
std::cout << "sum of difference should be 0: " << (cv::sum(img2-img)) << std::endl;
std::cout << "check: ffprobe out.avi" << std::endl;
std::cout << "format should be bgr0" << std::endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment