PDA

View Full Version : Capture lock with DV codec



willyx
February 3, 2004, 10:21:07
Hi, i've a problem with avistartcapture metod and DV codec (microsoft). I've always used divX4.12 codec with no problems (IC 1.41, DX 9.0b, Canopus ADVC 1394). Now we need to use DV codec (PAL), and

after a lot af start/stop (2-20), i've this error in this line:
ICImagingControl.AviStartCapture nomefilm, cboVideoCodec.Text


An unexpected dshowlibexception occured:
cfiltergraph::startgraph():failed to start the graph
COM error: one or more arguments not valid
in file: c:\csource\core\dshowlib\filtergraph.cpp line 595

Sometimes the error happen in the stop method, with only a VB error like "unable to use the stop method" (but no other info).

Any idea?

willyx
February 3, 2004, 14:33:28
Sometime i've this message (after 102 start/stop, could be a nasty bug to reproduce)
An unexpected dshowlibexception occured:cfiltergraph::connect(CPin& src,cPin& dest, CONST

CVideoFormat inttype): Pins allready connected.
In file: c:\csource\core\dshowlib\filtergraph.cpp at line 749

Stefan Geissler
February 5, 2004, 12:33:38
Hello,

I did 891 tests with the DV Encoder from MS without any problems. I have rather got the impression that there is a timing problem. If there is no delay between start and stop, build a wait time between the AVICaptureStop and the AVICaptureStart call. A simple way to insert a wait function is as follows:

Declare the Windows API function "Sleep" on top of your form:


Private Declare Sub Sleep Lib "Kernel32.dll" (ByVal millisek As Long)


Use it for 1 second wait time:


Sleep 1000


This should give the capture thread enough time to destroy the filter graph and release all used filters.

If you want to capture only some seconds to an AVI file, make a pause and start capturing again (to the same AVI file), you should use the "LiveCapturePause" property of IC Imaging Control. This pauses AVI capture but the filtergraph still remains in memory and does not need to be rebuild, after the pause mode is suspended.
After the pause us supended, the AVI capture starts immediately.

For my tests i used DirectX 9. May be you should also use DirectX 9.

willyx
February 10, 2004, 15:09:57
I've tried the DemoApp.exe sample in the bin directory and seems to be ok. I've run the VB example Samples\VB6\Building an Application\ and I've the same problem. This happen only with DV codec. I've put the sleep code (in the example project), but the problem is the same. This happen sometimes after 1/50 start/stop and sometimes i need to reboot the system because works well after 100 attempts (reboot because it works:).
Have you run the c++ or the VB code? The old bug I've found (the reason of 1.41), was present only with VB code...

Stefan Geissler
February 11, 2004, 07:56:43
Hello,

This sounds strange. We did some more testing on different computers and wre not able to reproduce the problem with the DV encoder. I used the Visual Basic application for my tests.
What kind of video capture source do you use and what video format is set? What Windows version is in use?

willyx
February 11, 2004, 14:27:34
Win2k SP4 and XP SP1, Canopus ADVC 1394, DV Codec Microsoft PAL. Source is "videoregistratore o telecamera DV" (Generic DV source).

Stefan Geissler
February 13, 2004, 13:11:22
Hello,

Is the displayed name of the codec "DV Video encoder" or is it
"DV Codec Microsoft PAL"?

willyx
February 13, 2004, 16:01:26
DV Video Encoder :)

Chris.Davis
February 25, 2004, 13:40:25
WillyX,
I've seen this problem too, although not with the PAL version of the Microsoft DV codec. At the time I reported it to the support team they said it was the codecs fault. By the way, this also happens with the Microsoft MPEG-4 Video Codec V2 & V1. It happens after about 50 start / stop combinations on the DV codec and 36 or so on the MPEG-4 Codec. The only solution I could find was to use version 1.3 of thier software. It did not exhibit the same problem with those two codecs.

willyx
March 4, 2004, 14:39:58
Hi, any news?
We have a lot of problem 'cause of this error. If u want, u can send me a debug version of ic, with log or any extra to find the reason. If IC 1.3 haven't this problem, seems strange that is only a bug of the codec.
Please I support Team, REPLAY!

willyx
March 9, 2004, 08:36:22
Any news?

Stefan Geissler
March 9, 2004, 14:38:20
WillyX,

I hurry and i REPLY.

Try a "DoEvents" call before AviStopCapture and before AviStartCapture.

Without this, i was now able to reproduce this problem With it, i did 129 test without problems.



Private Sub Timer1_Timer()
iCounter = iCounter + 1
lblCount.Caption = Str(iCounter)
DoEvents
ImagingControl.AviStopCapture
DoEvents
ImagingControl.AviStartCapture txtFilename, cboVideoCodec.Text
End Sub

Stefan Geissler
March 9, 2004, 14:47:36
If you use a timer, you should disable the timer in the timer sub to avoid multiple calls of this sub:


Private Sub Timer1_Timer()
Timer1.Enabled = False
DoEvents
iCounter = iCounter + 1
lblCount.Caption = Str(iCounter)
DoEvents
ImagingControl.AviStopCapture
DoEvents
ImagingControl.AviStartCapture txtFilename, cboVideoCodec.Text
Timer1.Enabled = True
End Sub

willyx
March 11, 2004, 14:35:36
Originally posted by Stefan Geissler
WillyX,

I hurry and i REPLY.
[/code]
:o


The problem is the same, however in my development PC is very hard to reproduce (100-200 start/stop), in another can happen every 10 capture...
I'll try to make a simple program without timers and other stuff to see if the problem persist.
I'll come back:)

Stefan Geissler
March 11, 2004, 14:39:44
Willy,

Please send your project, that produces the problem to support at imagingcontrol dot com?
My sample is attached.

willyx
March 12, 2004, 16:50:12
Hi, i've used the firstapp example from IC 1.41 and the frmwriteavi, i've changed this:

Private Sub cmdStartCapture_Click()
On Error GoTo err_cmdStartCapture_Click

If cboVideoCodec.Text = "" Then
MsgBox "Please select a video codec first.", vbExclamation + vbOKOnly
ElseIf txtFilename.Text = "" Then
MsgBox "Please select an AVI filename first.", vbExclamation + vbOKOnly
End If

If cboVideoCodec.Text <> "" And txtFilename.Text <> "" Then

While (True)
DoEvents
frmMain.ICImagingControl1.AviStartCapture txtFilename, cboVideoCodec.Text
cmdStartCapture.Enabled = False
cmdStopCapture.Enabled = True
cmdClose.Enabled = False

DoEvents
frmMain.ICImagingControl1.AviStopCapture

cmdStartCapture.Enabled = True
cmdStopCapture.Enabled = False
cmdClose.Enabled = True
Wend
End If
Exit Sub

err_cmdStartCapture_Click:
MsgBox Err.Description
cmdClose.Enabled = True
End Sub


Simply I've add an infinite loop of start stop.
A positive note, seems that the version with doevents is less prone to crash then the other.
I've noted that if i start the live preview, go in the write avi form, change the codec prop to pal and then start to grab an avi , I've error in the image below(something like: automation error, the object called disconnect itself from clients). If i don't change or open the codec prop, is possible to go with the loop for hours without problems. But if i reboot the PC sometimes I've the error without open the codec prop.

Stefan Geissler
March 15, 2004, 10:56:01
Hello,

You should try to remove the lines
cmdStartCapture.Enabled = False
cmdStopCapture.Enabled = True
cmdClose.Enabled = False

from the loop, because these lines cause windows messages too.

willyx
March 19, 2004, 16:45:57
We have changed codec, we'll use another DV codec:( (mainconcept DV codec works well)

Chris.Davis
July 8, 2004, 15:35:00
Willyx,
I downloaded / bought the Mainconcept DV Codec too, but was unable to make it work in ImagingControl 1.3 or 1.41. Anything special you did to make it work?


Chris Davis