Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

A Time-out has expired error on avi merge.
Started by justinpdavis at 01-30-2008 10:59. Topic has 3 replies.

Print Search « Previous Thread Next Thread »
  01-30-2008, 10:59
justinpdavis is not online. Last active: 1/25/2008 2:10:05 PM justinpdavis

Not Ranked
Joined on 01-25-2008
Posts 4
A Time-out has expired error on avi merge.

Attachment: error.JPG
Reply Quote
I have a simple project that takes two avi files and merges them. However, i am getting a "A time-out has expired" on the convertfile function at SampleStream = SampleTarget.WaitForSample(10000) line of code.

Public Function Merge(ByVal pFirst As String, ByVal pSecond As String, ByVal pFinal As String) As Boolean
Dim r As Boolean = True
Try
Dim StartHi As Long ' start time high
Dim StartLo As Long ' start time low
Dim SampleTarget As ltmmMultiStreamTarget ' sample target for ltmmConvertCtrl1
Dim SampleSource As ltmmMultiStreamSource ' sample target for ltmmConvertCtrl1
Dim mt As ltmmMediaType
Dim InsertedMediaType As ltmmMediaType
' set the start time to be 0
StartHi = 0
StartLo = 0
' INITIALIZE ltmmConvertCtrl1
' set the input filename
ltmmConvertCtrl1.sourcefile = pFirst
' set the output sample to a target object
SampleTarget = New ltmmMultiStreamTarget
SampleTarget.StreamCount = 2
mt = New ltmmMediaType
mt.Type = ltmmMEDIATYPE_Video
SampleTarget.SetAcceptedMediaType(0, mt)
mt.ResetMediaType()
mt.Type = ltmmMEDIATYPE_Audio
SampleTarget.SetAcceptedMediaType(1, mt)
' get the inserted media type for the first stream
InsertedMediaType = SampleTarget.GetAcceptedMediaType(0)
InsertedMediaType = Nothing
ltmmConvertCtrl1.TargetObject = SampleTarget
' START the source conversion, so we can get the media sample format
ltmmConvertCtrl1.StartConvert()
' INITIALIZE ltmmConvertCtrl2
' create a source object
SampleSource = New ltmmMultiStreamSource
' get the output media sample format and put it into the source object
SampleSource.StreamCount = 2
SampleSource.SetMediaType(0, SampleTarget.GetConnectedMediaType(0))
SampleSource.SetMediaType(1, SampleTarget.GetConnectedMediaType(1))
' get the inserted media type for the first stream
InsertedMediaType = SampleSource.GetMediaType(0)
InsertedMediaType = Nothing
' set the output filename
ltmmConvertCtrl2.TargetFile = pFinal
ltmmConvertCtrl2.SourceObject = SampleSource
' start the dest conversion
ltmmConvertCtrl2.StartConvert()
'Form1.Caption = "Converting file1..."
' convert first file
ConvertFile(SampleTarget, SampleSource, StartHi, StartLo)
' Restrict the output format to the media type of the source for the first file
' That is because the two files must have the same media type for both video and audio
' With video, you have to make sure the files have the same frame rate! Minor changes in
' the frame rate might make the connection fail!
' The control will tolerate differences in frame rate if you comment the next line
SampleTarget.SetAcceptedMediaType(0, SampleTarget.GetConnectedMediaType(0))
SampleTarget.SetAcceptedMediaType(1, SampleTarget.GetConnectedMediaType(1))
' change the source file to second file
ltmmConvertCtrl1.sourcefile = pSecond
' start converting again
ltmmConvertCtrl1.StartConvert()
'Form1.Caption = "Converting file2..."
' convert second file
ConvertFile(SampleTarget, SampleSource, StartHi, StartLo)
' deliver end of sample to stop the conversion
SampleSource.DeliverEndOfStream(0, 1000)
SampleSource.DeliverEndOfStream(1, 1000)
Do While (ltmmConvertCtrl2.State = ltmmConvert_State_Running)
Application.DoEvents()
Loop
'Form1.Caption = "Done"
' free the source and target objects
ltmmConvertCtrl1.ResetTarget()
ltmmConvertCtrl2.ResetSource()
Catch ex As Exception
r = False
End Try
Return r
End Function

Private Sub ConvertFile(ByVal SampleTarget As ltmmMultiStreamTarget, ByVal SampleSource As ltmmMultiStreamSource, ByRef StartHi As Long, ByRef StartLo As Long)
Dim msSrc As ltmmMediaSample
Dim msDst As ltmmMediaSample
Dim LastStartHi As Long
Dim LastStartLo As Long
Dim LastStopHi As Long
Dim LastStopLo As Long
Dim SampleStream As Long

Dim nFrames As Long

LastStopHi = 0
LastStopLo = 0

nFrames = 0
Do
nFrames = nFrames + 1

Debug.Print("nFrames=", nFrames)
' get the sample, allowing 10 s for the operation to complete
On Error GoTo EndConvert
SampleStream = SampleTarget.WaitForSample(10000)
msSrc = SampleTarget.GetSample(SampleStream, 0)
Debug.Print("Stream=", SampleStream)

msDst = SampleSource.GetSampleBuffer(SampleStream, 1000)

' copy the sample time
On Error GoTo ResetTime
' set the sample time
msSrc.GetTime(LastStartHi, LastStartLo, LastStopHi, LastStopLo)
' get the sample time
msDst.SetTime(StartHi + LastStartHi, StartLo + LastStartLo, StartHi + LastStopHi, StartLo + LastStopLo)
GoTo NoResetTime
ResetTime:
msDst.ResetTime()
NoResetTime:

' copy the data
On Error GoTo EndConvert
msDst.SetData(msSrc.ActualDataLength, msSrc.GetData(msSrc.ActualDataLength))

' copy the other flags
msDst.Discontinuity = msSrc.Discontinuity
msDst.Preroll = msSrc.Preroll
msDst.SyncPoint = msSrc.SyncPoint

' release the source sample
msSrc = Nothing
' deliver the destination sample
SampleSource.DeliverSample(SampleStream, 1000, msDst)
' release the destination sample
msDst = Nothing

Loop While (1)

ltmmConvertCtrl1.StopConvert()
StartHi = LastStopHi
StartLo = LastStopLo
Exit Sub

EndConvert:
ltmmConvertCtrl1.StopConvert()
StartHi = LastStopHi
StartLo = LastStopLo
Exit Sub

End Sub

   Report 
  01-30-2008, 15:08
GregR is not online. Last active: 11/26/2008 3:40:25 PM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,717
Re: A Time-out has expired error on avi merge.
Reply Quote
I don't see anything at first glance.  We ship a demo with our toolkit that concatenates two files together called "Concat Same Size".  Take a look at that demo and see what you are doing differently.

If that demo doesn't point you in the right direction, please put together a small sample project (NOT your entire application or a code snippet) that isolates the problem so I can try to reproduce it here.  If this only occurs with specific videos, please upload those as well.  Otherwise, I'll assume it can be reproduced with the videos in our Media directory.

Finally, what is the file version of ltmm15.dll and DSKernel2.dll?

NOTE: If you are attaching a project or file to the forums...
1.) Zip the file(s) up.
2.) Make sure it is less than 5 MB.  If it is larger, please send an email to support@leadtools.com and we'll send you FTP instructions.
3.) Remove ANY AND ALL unlock codes and LEADTOOLS DLLs.
4.) Do not click the preview button, the attachment will not show up when you post it.
 
If you do not wish to post your file(s) on the forum since they are publically viewable, please send an email to support@leadtools.com and make sure that you include a link to this forum post.


Greg Ross
LEADTOOLS Technical Support
   Report 
  03-07-2008, 15:16
prkchpxprss is not online. Last active: 2/27/2008 4:10:43 PM prkchpxprss

Not Ranked
Joined on 02-08-2008
Posts 3
Re: A Time-out has expired error on avi merge.
Reply Quote
Was this ever resolved?
   Report 
  03-10-2008, 8:22
GregR is not online. Last active: 11/26/2008 3:40:25 PM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,717
Re: A Time-out has expired error on avi merge.
Reply Quote
I don't recall getting an email from justinpdavis, so my assumption is that he figured it out.

If you are having the same or similar problem, my questions are the same as for him.  Please read my previous post to answer my questions and follow my suggestions and I'll be glad to help you.

Greg Ross
LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » Enduser » Capture & Conve... » A Time-out has expired error on avi merge.

Powered by Community Server, by Telligent Systems