Skip to content

Instantly share code, notes, and snippets.

@eruffaldi
Created January 13, 2018 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eruffaldi/30b898d2744a3b5a1453e08e3c4da7dc to your computer and use it in GitHub Desktop.
Save eruffaldi/30b898d2744a3b5a1453e08e3c4da7dc to your computer and use it in GitHub Desktop.
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));
vw.write(img);
vw.release();
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