Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd June 2003, 00:27   #1  |  Link
Cyberia
Moderator
 
Cyberia's Avatar
 
Join Date: Nov 2002
Location: Inside
Posts: 718
AviSynth framecount issue

I am writing an application that uses a mediaplayer ocx control, and from the control I determine the timelength and framecount of the playing video.

If I open an avi directly through the mediaplayer ocx, it reports the correct file attributes... the same than VirtualDub reports, that is.

But if I open the avi through an avs script, the player reports the the timecount for BOTH timecount AND framecount. The timecount value is correctly reported, but I don't want it twice.

Virtual dub reports the correct values for the file opened through Avisynth.

The avs script is very simple:

AVISource(myfile.avi)


Although this could be a mediaplayer bug, it sounds like maybe AviSynth isn't reporting the framecount in the manner mediaplayer (ocx) wants it. Shouldn't AviSynth scripts work transparently in ANY application?
Cyberia is offline   Reply With Quote
Old 2nd June 2003, 18:30   #2  |  Link
Cyberia
Moderator
 
Cyberia's Avatar
 
Join Date: Nov 2002
Location: Inside
Posts: 718
Ok, massive response so far.

Lets try tackling this from another angle: Does any have (or know of)an example on how to query the AVIFile or AVIStream API's from VB6?

I have code trying to do this, but it returns inconsistent values between clips. I'd just like to see someone do it properly. Actually, even if you can't do that, can you tell me what calls I *should* be making in the correct order? (AVIFileOpen, then AVIFileInit, ... read the struct ... AVIFileClose)

I don't want to play the avi in this way, just to determine it's basic properties (height, width, framecount, timelength etc)

Sorry if I am being retarded.
Cyberia is offline   Reply With Quote
Old 3rd June 2003, 04:01   #3  |  Link
Cyberia
Moderator
 
Cyberia's Avatar
 
Join Date: Nov 2002
Location: Inside
Posts: 718
Nevermind, I got it. Actually I had it, but had a typo.

Thanks to everyone who responded! Out of gratitude for all you help I have decided to give everyone who has posted so far ALL THE MONEY I HAVE. Couldn't have done it without you.

You know who you are.

EDIT: If anyone is interested, I decided to release an example. So here it is: AviStreamInfo using VB6

Last edited by Cyberia; 3rd June 2003 at 05:50.
Cyberia is offline   Reply With Quote
Old 8th June 2003, 07:01   #4  |  Link
fisix
Registered User
 
Join Date: Oct 2001
Location: Los Angeles
Posts: 168
yay!

show me the money?

-fiz
fisix is offline   Reply With Quote
Old 8th June 2003, 17:13   #5  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
@Cyberia: I don't know anyone here who works with VB, so that may be the reason for the lack of responses. Glad you got it resolved in the end!

@fisix: Remember rule 11, please.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 8th June 2003, 19:30   #6  |  Link
Cyberia
Moderator
 
Cyberia's Avatar
 
Join Date: Nov 2002
Location: Inside
Posts: 718
@fisix: Sorry the offer was only good until I posted the code. Too Bad.

@Shodan: Yea, I understand most people are not coding in VB, but all I needed was the name and order of the API calls (in any language) and I could transcode it to VB. I think most people would be surprised at how fast and powerful VB is now (obviously NOT for intensive apps, but for small simple apps its GREAT)

FYI: There are FIVE API calls necessary for this operation - (EDITED)
AviFileInit
AviStreamOpenFromFile
AviStreamInfo
AviStreamRelease <--- Dont forget this one!!
AviFileExit

Last edited by Cyberia; 10th June 2003 at 18:38.
Cyberia is offline   Reply With Quote
Old 10th June 2003, 18:37   #7  |  Link
Cyberia
Moderator
 
Cyberia's Avatar
 
Join Date: Nov 2002
Location: Inside
Posts: 718
Crap. There is a BAD BAD BAD memory leak in the posted code. This is such a stupid mistake, sigh.

I completely forgot to release the stream when finished. The problem gets worse as you try to test more and more videos because the previous stream was not freed, but a new stream is created every time you scan a file. Fortunately, it seems that all memory is returned to the system when you close the program.

I have the fix ready and will put it up when I get home tonight. So in the off chance anyone has looked at the code, don't use it. Get the update.

EDIT: The update is now available at the above link.

Last edited by Cyberia; 11th June 2003 at 00:15.
Cyberia is offline   Reply With Quote
Old 10th June 2003, 18:42   #8  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
Heh - A very easy thing to forget.

Anyway - thanks for sharing your code - I'm sure it'll be appreciated!
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 16th March 2004, 10:32   #9  |  Link
vion11
Registered User
 
Join Date: Oct 2002
Posts: 167
The example exits with err=28 "Out of stack space" at line:

Call AVIStreamRelease(ByVal pavi)

in function LoadAviStreamInfo() and no framecount is reported.

Whats wrong?
vion11 is offline   Reply With Quote
Old 5th April 2004, 18:33   #10  |  Link
Cyberia
Moderator
 
Cyberia's Avatar
 
Join Date: Nov 2002
Location: Inside
Posts: 718
Well, I'm not sure. What file are you trying to scan? Can Vdub open it and get a File Information from it?

Reboot and try again. It should work.
Cyberia is offline   Reply With Quote
Old 7th April 2004, 15:21   #11  |  Link
vion11
Registered User
 
Join Date: Oct 2002
Posts: 167
Using "version()" as script still same error.
Type AviStreamInfoStruct has good values, next
lines relases bad to reported error.

More Infos???
vion11 is offline   Reply With Quote
Old 16th April 2004, 13:28   #12  |  Link
vion11
Registered User
 
Join Date: Oct 2002
Posts: 167
Example works with AviSynth version 2.08.
First not working version I've found is beta 2.5 (jan2003)

Can somebody verify/falsify this fact please!

For handyness the test exe from cyberia: Link

Access to AVIFile library is necessary to extract and
display frames from avs files => per filter preview in editors.

Last edited by vion11; 16th April 2004 at 13:44.
vion11 is offline   Reply With Quote
Old 16th April 2004, 14:43   #13  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480


The example loads an avs nicely with 2.5 (i tried simply putting a version() in the avs).
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 16th April 2004, 19:27   #14  |  Link
vion11
Registered User
 
Join Date: Oct 2002
Posts: 167
Hmmh local error.
But why difference between versions?

How can I reinstall/check/test avi support (w2k)?
(want to avoid complete system new install)
vion11 is offline   Reply With Quote
Old 16th April 2004, 22:19   #15  |  Link
Cyberia
Moderator
 
Cyberia's Avatar
 
Join Date: Nov 2002
Location: Inside
Posts: 718
Shodan, thanks for confirming what I was seeing. I simply CAN'T get it to break at all. I am running WinXP, but the call that is failing (AVIStreamRelease) was present in Win95 and up according to the MSDN.
Cyberia is offline   Reply With Quote
Old 19th April 2004, 16:17   #16  |  Link
vion11
Registered User
 
Join Date: Oct 2002
Posts: 167
Checking other ressources/samples I have no doubt code is correct
and in addition it runs perfect with old version.

Would like to see a verification from w2k machine...

It is simple: open *.avs and when
dialog shows numbers => ok
if dialog shows N/A => nok
vion11 is offline   Reply With Quote
Old 19th April 2004, 16:25   #17  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
FYI I tested on an XP machine. SP1+latest patches.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 19th April 2004, 19:35   #18  |  Link
vion11
Registered User
 
Join Date: Oct 2002
Posts: 167
It runs now, haven't find out exactly what was wrong.
(de+installed sp4, all codecs, wmp 9, wmp 6.4)

Here are exe + sources to display frames extracted
from avs file with visual basic 6.0.
Many thanks to cyberia and shrinkwrapvb.com
Link (50kb) no runtime library
vion11 is offline   Reply With Quote
Old 20th April 2004, 00:45   #19  |  Link
Dark-Cracker
Registered User
 
Dark-Cracker's Avatar
 
Join Date: Feb 2002
Posts: 1,195
hi,

instead of SetDIBitsToDevice24 api i suggest u the DrawDibDraw api.

++
__________________

AutoDub v1.8 : Divx3/4/5 & Xvid Video codec and .OGG/.MP3/.AC3/.WMA audio codec.
AutoRV10 v1.0 : Use RealVideo 10 Codec and support 2 Audio Streams and Subtitles.

Dark-Cracker is offline   Reply With Quote
Old 20th April 2004, 02:27   #20  |  Link
Cyberia
Moderator
 
Cyberia's Avatar
 
Join Date: Nov 2002
Location: Inside
Posts: 718
There is some Good Stuff™ in this code! Thanks for sharing it!
Cyberia is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:16.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.