Get the duration of an AVI animation. No need to manually play the animation out and try to detect when it is no longer animating.
Back Story:
I have about 3500 video files and it would have taken about
23 days to have the program manually play each one and measure the lengths so they could be stored and later used. So rather than do that and since there appears to be no documented command to get this information, I found an AVI format spec sheet and whipped up a small function to read the duration from the file. No need to wait, saved myself nearly a month.
Open an AVI file and extract the duration:
`Opens an AVI file to extract the duration.
Function Get_VideoDuration(oFile$)
`Setup variables
retVal = 0
oDelay = 0
oFrameCount = 0
`If File exists
If File Exist(oFile$) = 1
Open to Read 1, oFile$
`Skip the header
Skip Bytes 1 ,32
`Read the frame delay in microseconds (thousandth of a millisecond)
Read Long 1, oDelay
Skip Bytes 1 ,12
`Read the frame count
Read Long 1, oFrameCount
Close File 1
EndIf
`calculate the duration and convert it to milliseconds
retVal = (oDelay * oFrameCount) / 1000
EndFunction retVal
See my previous tip here...
https://forum.thegamecreators.com/thread/220759