Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Videiwriter create an avi with broken ot missing AVI Index

$
0
0
I'm using videoWriter to create a video. I'm using VS 2012 in windows. The idea of the code is to : 1. create a VideoWriter object 2. open a pre-existent image (a set of them inside a for loop) 3. add some boxes 4. save it to the video The code works. But when it creates the video files and I try to open it with VLC I get the following error ![VLC Error Box](/upfiles/14750822555960798.png) If I open it windows media player take a bit but it opens. I wonder if somebody can help me to figure out what's going on I need to use a video player more advanced than WMP #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/imgcodecs/imgcodecs.hpp" #include "opencv2/videoio/videoio.hpp" double frameRate = 30.0; cv::Size frameSize( 640, 512 ); std::string const videoPath ="E://videos//" std::string const framePath ="E://frame//" cv::Mat imToShow; int main( void ) { std::string videoFile = videoPath +"video_test.avi" cv::VideoWriter videoObj( videoFile, CV_FOURCC_DEFAULT, frameRate, frameSize ); if ( !videoObj.isOpened() ) { std::cout << "ERROR: Failed to write the video" << std::endl; std::cin.get(); return -1; } for ( int ifrm = 0ifrm < 301; ++ifrm ) { std::string imFullName = framePath + "//frame_" + std::to_string( ifrm ) + ".tif"; imToShow = cv::imread( imFullName, CV_8UC3 ); cv::imshow( result_window, imToShow ); cv::waitKey( 35 ); //do some processing that adds a box to the image drawBox( imToShow, corrDet, message, fontDefault ); videoObj.write( imToShow ); } }

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>