Ask Your Question

dom_beau's profile - activity

2014-01-13 22:28:42 -0500 answered a question AVI file created by OpenCV 2.4.6 not always valid when app exits

Hello!

After few tests, I definitely would not push further the investigation. I got an "invalid" .avi file, then waited for ~10 seconds, then tried to re-read it again and all was correct.

IMHO, the problem is in the way VirtualBox synchronizes its virtual disks. I won't worry much more about this issue.

Thanks Alexander Smorkalov for the help anyway.

Dominique Beauchamp

2014-01-10 09:37:31 -0500 commented answer AVI file created by OpenCV 2.4.6 not always valid when app exits

My issue doesn't look like the one you are referring to. Actually, I experience no syncing problem when my capture application is started via a php script on my server. I experience sometimes syncing problems when I launch it from the command line. The first thing I will try is to call it directly on my host, not in VirtualBox. After some reflections, I suspect a syncing problem with the virtual disk. I'll let you know here.

2014-01-08 07:52:41 -0500 asked a question AVI file created by OpenCV 2.4.6 not always valid when app exits

This is a copy of the question: http://stackoverflow.com/questions/20987800/avi-file-created-by-opencv-2-4-6-not-always-valid-when-app-exits


I'm currently using OpenCV 2.4.6 with gcc 4.7.3 on Lubuntu x64. To view the AVI I use gnome-mplayer 1.0.8 (installed with Lubuntu). All the kit is running on a VM in VirtualBox.

I use the common code suite to grab images then add them to the VideoWriter. In a (second) thread, I do this:

cv::Mat lImg;
cv::VideoCapture lVidCap( 0 );
cv::VideoWriter lVidWrt( lFileName, CV_FOURCC( 'M', 'J', 'P', 'G' ), 15, cv::Size( 640, 480 ) );

while ( true )
{
    // Here check if we must quite the loop.

    lVidCap.read( lImg );
    lVidWrt.write( lImg );
}

// This is not required according to the doc...
lVidWrt.release();
  1. It works correctly sometimes.

  2. On other times, I have to wait for many seconds before the file is valid (despite it is indicated that it takes many Mb, in gnome-mplayer it is written 0k).

Why is the file not always available as soon as the VideoWriter is destroyed?

If you have any suggestion, I would like to read it! ;-) Thanks!