Thread: Opencv writing video FOURCC "IYUV" or "I420"
dear community,
see intermediate results of videooprocessing using opencv2.3.1 used videowriter see results when program ended. used write frames using cv::videowriter( string filename, int fourcc, int fps. used codec fourcc codec "iyuv" or "i420" since able write fast file. in example below present code example below i'll show piece of code "mjpg" fourcc, in program runs in realtime system can't keep if has write , compress mjpg. writing codec "iyuv" used work seemed fail last week on night. writer writing file kind of codecs mentioned above, when writing iyuv or i420 (which think synonemous) resulting video looks screwed.
these results on ubuntu 10.10 , 10.04. opencv2.3.1 build source.
below i'll give sample program demonstrates problem simple webcam.
if compiled with:
the writer make file output.avi file can investigate mplayer of default movieplayer.code:$g++ -o writer capture_writing.cpp `pkg-config --cflags --libs opencv`
if compiled with:
it starts write output.avi nothing wrong, when viewing file video player colors mixed see small piece of total frame shows stars , stripes, i'm not filming american national flag myself.code:$g++ -o writer capture_writing.cpp `pkg-config --cflags --libs opencv` -d problem
capture_writing.cpp
is:
has perhaps idea why writing iyuv or i420 not working anymore?code:#include <iostream> #include <cv.h> #include <highgui.h> using namespace cv; using namespace std; int main() { videocapture cap (0); cap.set(cv_cap_prop_frame_width, 640); cap.set(cv_cap_prop_frame_height, 480); mat mat; cap >> mat; //cout << "the fps = " << cap.get(cv_cap_prop_fps) << endl; videowriter writer( "output.avi", #ifdef problem cv_fourcc('i','4','2','0') , #else cv_fourcc('m','j','p','g') , #endif 30, size(mat.size()) ); if ( !writer.isopened()){ cout << "couldn't open writer" << endl; return 1; } namedwindow("win",1); while ( (short) waitkey( 20 ) != 'q'){ mat mattie; cap >> mattie; writer << mattie; imshow("win",mattie); } return 0; }
welcome.
kind regards,
maarten
nobody has been able me yet, perhaps idea move thread multimedia & video doubting when posted thread of 2 appropriate?
maarten
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support Multimedia Software Opencv writing video FOURCC "IYUV" or "I420"
Ubuntu
Comments
Post a Comment