I have been able to use AVIFileOpen, AVIFileInfo and AVIFileGetStream, AVIStreamInfo on .avi files from a Sony DV camcorder captured with several different tools. AVIStreamReadFormat and AVIStreamRead work fine. This gets the video into a buffer but it's still compressed. I have not been able to suceed with AVIStreamGetFrameOpen; it returns a NULL. How should I proceed to get the uncompressed video? Visual C++.NET under XP pro. Thanks,
+ Reply to Thread
Results 1 to 12 of 12
You probably have to explicitly connect to a codec somehow.
Sorry I don't know how
Yes, I've got qdv.dll (which contains the codec) on my computer but I too don't know how to interface to it. I'll keep searching. Thanks,
Sorry, but at the moment, I'm on my way out, and I really couldn't
"RIP" the code snip out of my project file I got working (am in the
debugging stages.. want to create a "frameserve client" and it's no
picnic, and I too, need some help in this)
Yeah, I actually started out w/ a WAV to AC3 code snip, and built
on top of that w/ Video. The app works but needs some error checking
code (IOW, more work)
The code snip is from one of my Delphi 6 apps I'm currently toying
around with. I have a trackbar that I use to scan through the .AVI
file. I'm working on some ideas, ie, De-Interlace and some Color
filtering and a few other fun things to work my brain on
also, my code is VERY messy. I've ben meaning to clean it up some,
so that EVEN I can read it !!
Good luck for now,
// opens an AVI file Error := AVIFileOpen(pFile, PChar(lbeFileName.Text), 0, nil); // Open stream from file Error := AVIFileGetStream(pFile, AVIStream, streamtypeVIDEO, 0); // decompress the video frame gapgf := AVIStreamGetFrameOpen(AVIStream, nil); // Reads in the Frame and, returns address of 'decompressed' frame iFrameNumber:=tb1.position; lpbi := AVIStreamGetFrame(gapgf, iFrameNumber); // creat the Bitmap frame.. bm := TBitmap.Create;
What codec does your AVI use ?
Returns a GetFrame object that can be used with the AVIStreamGetFrame function. If the system cannot find a decompressor that can decompress the stream to the given format, or to any RGB format, the function returns NULL.
My code is essentially the same as vhelp has shown, with a lot more error checking and debug statements. As FOO points out, the NULL from AVIStreamGetFrameOpen is because it couldn't find the decoder. The Sony camcorder uses a "dvsd" codec. Since both Media Player and Quicktime show the video, the codec is on my system, in qdv.dll. I simply don't know how to get Visual C++ to maske use of it in the project. Any ideas? Thanks,
I read some more . It is possible that you have to create
an instance of a filter graph builder thingy . I forgot what they call it.
The implication is that is what auto detects the codec based on the 4cc code.
Another trick would be to get and read Avisynth or Vdub source.
I saw about 1 page in Avisynth where they were trying to figure
out what codec to use . The last part had a comment that said
"this usually doesn't work"
actually, all my testings to get the code snips (C++ conversion) in my Delphi
app were all based on (in addtion to trial n error, cause I don't know too
much of C++ but just enough, given time and bordom and a willing'ness ta
get it working) Other parts of code I got from other Delphi snips. I just
put a few pieces together, and after a few days (weeks) its working :P
Oh, yeah,... as I was saying..
All my .avi source files were DV footage from my came or my ADVC.
As I said earlier (I think) (too lazy to re-read) my app does not make any
calls to this qdv.dll file when calling any helper apps (if any) I even
renamed it to some other name, and my app opened the .avi file. It's all
just a matter of having the right order of calling each function. That's why
I laid it out exactly as it is in my source, and I included the comments so
you would understand whta each function does and how to call them. Should
be just as easy (or easier) to call (convert to) C++
Actually, to quite honest w/ you all, my main goal for this AVI app was just
to be able to capture a frame and save to a .bmp file. I do lots of .avi work
and comparison, and I often have frameserves setup and ready to go. And,
after I see the results, if I liked it, I would copy the pic to clipboard and then
open PSP and save as .png or other, and so on and so forth. But, this got
too tiresome, and I wanted (once and for all) a much shorter way of doing
this. And, now I do
I just open my .avi file, go to any frame I want (hmm, I need to add in a
"GOTO Frame" feature) and click one button, and I'm finished, only a couple
of keystrokes or seconds :P
Now, in building up this app, I want to go the extra mile and include some
form of (maybe rough) filtering processes (of which I already laid out in my
Right now, the only problem w/ my app is that it's pretty messed up. I have
juggled a lot of code snip to various function (outside the subroutines) that
things are confusing and hard to follow even for me, if I step away too
All those items I listed were those that I split up into separate functions, but
they were basically in the same order of operation. I even tested it and it
did worked (in a tiny app)
I think that you are missing something in your code. My code (given the
above snips) makes calls to the AVIFIL32.dll if that helps. Are you
calling this library ?? ..or an older one ie, AVIFILE.DLL file.
I'm also running under Windows 98, if that matters.
Use "ICLocate" to locate decompressor,
and "ICDecompress" to decompress"I´m not popular enough to be different"
If I get the time, I'll try muster a little clean up of my source, and put it
in logical order for you to understand (and use aka, convert to C++) if you
would like On the other hand, I don't want to "taint" what you got with
your C++ code. I know how difficult it can be messing around w/ other
C++ for me, is a great pain in the butt, ..at least for me, when I was
first messing around w/ opening an AVI.
Going to other forums and getting the answers can be just as hard, if not
harder because there are lots of "selective" people who will give
only a hint of what to do - if you know what I mean. That's why I struggled
many days (weeks trying to get this simple little project working)
I'll see what I can do (if you havn't figured it out already) and try this week
end. But, no promises cause I'm exhausted w/ work these days, w/ my
new manager (whom I argue and fight w/ every day (other day)) So, that
nonsense wares me down lots, and I usually don't want to do anything but
read posts here and whatnot.
Sorry for the lecture
Hope you got it working though,
Thanks guys for your comments. ICOpen, ICLocate also return zero, still meaning they can't find the codec. I have concluded that, since the avi plays fine under Media Player and others, the problem is not my code but rather the codec in qdv.dll is for DirectShow and not Vfw. One of my friends suggested it might be more productive to learn Direct Show than to follow this path. Also, I'm on XP Pro which doesn't have the easily modified system.ini file as the older OSs had. Thanks again for the comments.
Maybe it's kinda late but I had same problem.
You can try to use AVIStreamOpenFromFile(
instead of AVIFileGetStream(.
My app works excellent.