PDA

View Full Version : Saving multiple video files



dwsubc
December 6, 2007, 19:45:02
Hi,

I am having a lot of trouble saving multiple video files to disk because the video display keeps freezing.

Is there a code sample that would robustly do something like this call:

saveVideo( string filename, int duration )

thanks
Dave

Stefan Geissler
December 7, 2007, 08:36:07
Dave,

the AVI capture has a higher priority than the live display. Thus you can not see the live video due to AVI capture. If the used codec is fast or you use a fast computer, then the live video will be displayed too. I have the same issue on my AMD 1600+ when I use the old MJPEG Compressor.

At least, I have no such code sample. It sounds for setting up a timer, that stops the AVI Capture after the duration elapsed. IC Capture is able to do this:
http://www.imagingcontrol.com/downloads/trials/

dwsubc
December 7, 2007, 14:48:53
Thanks Stefan,

I tried switching off the live display but it made little difference. My PC is a 2.6GHz Pentium 4 with 2GB ram so it should be fast enough to save with the display turned off.

Below is a simplified sample of what I am trying to do. I choose the device using the standard code from your samples and then call icImagingControl1.LiveStart(). I then call the routine below which should save a thousand avi files, each 0.1s long. After a random number of files, the programme freezes and I can only shut it down by disconnecting the camera. Any ideas of what I am doing wrong?

ps
I never see an exception message when the programme freezes. I would be happy if the programme returned an error which I could act on.

pps
This happens on my laptop as well.

quote-----------------------------

for (int i = 1; i <= 1000; i++)
{
try
{
icImagingControl1.LiveDisplay = false;
icImagingControl1.AviStartCapture("C:\\capture\\test" + i.ToString() + ".avi", "Y800");
System.Threading.Thread.Sleep((int)(100.0));// 0.1s delay
icImagingControl1.AviStopCapture();
icImagingControl1.LiveDisplay = true;
buttonSleep.Text = i.ToString();
buttonSleep.Refresh();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}

unquote--------------------------

thanks
Dave

dwsubc
December 7, 2007, 15:05:07
Stefan,

Here is the text file that Windows prepares when I try to close the programme down. It's nonsense to me but it might help you.

Dave

Stefan Geissler
December 7, 2007, 15:29:09
Dave,

It seems, I misunderstood you. I understood, the live display freezes, shows up no new frames due to AVI Capture. I did not realize that you were talking about a program error.

What video capture device do you use?

dwsubc
December 7, 2007, 15:38:32
Apologies Stefan,

I should have mentioned that the programme freezes. The device is a mono USB camera DMK 21AU04, serial number 43700269.

Also, I thought that this line might be causing the error.

System.Threading.Thread.Sleep((int)(100.0));// 0.1s delay

I therefore replaced it with a timer event that I used to start and stop the capture. Unfortunately, I get the same result. The programme saves a random number of files and then freezes.

Dave

dwsubc
December 8, 2007, 13:24:47
Stefan,

I added some traps to my code to see exactly where the problem arises. It seems that the problem always arises during the call to icImagingControl1.AviStartCapture(). I got failures after saving 88, 115, 169, 11 and 315 files.

I then spotted that there was a similar problem in the ActiveX forum where you suggested calling DoEvents() before AviStartCapture() and AviStopCapture(). Unfortunately, this did not solve the problem.

I then tried testing icImagingControl1.DeviceValid before the call to AviStartCapture(). This showed that the device was valid before the call.

Finally, I tried saving the same type of files under IC Capture 2.0. This showed the same problem with the programme freezing after 16 and 15 files.

You kindly sent me the long exposure firmware mod for my camera some time ago. I tried to install it but got an error and cancelled the install. The camera maximum exposure is still showing as 30sec so I guess the original firmare is still in place. I wonder if this is part of the problem?

Dave

Stefan Geissler
December 10, 2007, 08:14:44
Dave,

Its a firmware problem of your USB camera. Please send an email to support@imagingcontrol.com, thus I am able to send you the (simple to use) firmware update software.

The problem in the old firmware is that many start - stop sequences can create a problem on the USB stuff. It is fixed in the new firmware.

dwsubc
December 10, 2007, 15:21:22
Many thanks Stefan,

I just saved 1,000 video files to disk on my desktop (XP Home SP2) and they seem OK. However, I still got a freezeup after only 15 files on my Vista Business laptop. Do I need to run the firmware update programme on the laptop as well?

Dave

Stefan Geissler
December 10, 2007, 15:28:32
Dave,

No, the firmware update is to be done once, it is the software running in the camera that is exchanged. I tested Windows Vista too, but I did not got this error. You reinstall the camera's driver.

dwsubc
December 11, 2007, 14:10:29
Stefan,

I found the Vista problem. I was trying to save videos with 0.1s duration. When I changed it to 1s duration the problem went away and I have just saved 1,000 files OK.

Dave

Stefan Geissler
December 11, 2007, 14:19:35
Dave,

thank you for your feedback! I was a little bit concerned about this issue. Now enjoy your glass of wine :-)