View Full Version : VFW sucks! What should I replace it with? [edited title]
MasamuneXGP
6th June 2006, 01:50
Hello all. I'm coding a program that involves subtitle timing. I wish to make this program compatible with h264 MP4 video files. Unfortunately, my program does all its video work with the vfw API, using functions such as AVIStreamGetFrame and the like, rendering MP4 sources unusable except through AVISynth. DirectShowSource allows MP4 file to be loaded in my program, however, the timestamps are all off, presumably due to b-frames and other h264 weirdness. This is obviously unacceptable for the purposes of subtitle timing.
So what I'm looking for is an AVISynth filter that can load MP4 sources while keeping the timestamps the same. In other words, if my vfw application tells me a certain frame appears at certain time, if I were to jump to that time in the original MP4 source, I would get the exact same frame. Is there such an animal? If not, I suppose I should consider scrapping vfw all together, although, what are my alternatives? Admittedly, that question is out of the scope of this particular forum, so I should probably repost in the MPEG-4 AVC if the there is no filter that can solve my problem.
Thanks in advance =)
foxyshadis
6th June 2006, 05:16
Sort of like DirectShowSource("...",fps=23.976,convertfps=true)?
Avidemux might be able to help you better though, it works natively with mp4 instead of through DirectShow, which can be a major pain for these things.
Move it to the container forum if anywhere, btw, this has nothing to do with AVC itself.
you maybe should also add the avisynth option to convert the video stream to cfr, cause mp4 files can also be vfr (but hardly are), which vfw simply doesnt handle (and never will)
MasamuneXGP
7th June 2006, 04:08
Okay so, after some experimentation, I'm still very not satisfied. For one thing, the fps= part of the DirectShowSource line does appear to work, but the framerate turned out to be (24000/1001) which is slightly off from 23.976. Don't ask me why, I couldn't even tell you. (For the record, the video file is an x264 encode of The Matrix Revolutions that I encoded myself from my personal copy. How the hell did I end up with such a weird framerate?) So anyway when I plug in the actual framerate of 23.976023976...etc, it appears to be exactly 2 frames behind throughout the vid. Much better of course, but still not acceptable.
The more I experiment, the more I think I should just kick VFW to the curb. Even if I get MP4s working, there are probably other stumbling blocks I'll run into eventually. The only think I can think of to replace it is to do a full DirectShow implementation (somthing I have no experience with, but I'm sure I could learn.) From what I assume, DirectShow really isn't built for a frame-by-frame editing process, but I guess that's nothing a little buffering couldn't fix.
I definately wouldn't want to do it though unless I was sure it would fix my problems. Would a DirectShow implementation be optimal for my situation? Or is there another option I am unaware of?
Many thanks to you doom9-ers and your massive knowedge...
GodofaGap
7th June 2006, 07:10
24000/1001 is the correct frame rate for NTSC FILM. But I don't know why calling a file with DirectShowSource would cause a two frame lag.
The major pain with DirectShow is third-party filters. It's not that DirectShow cannot do the thing you request from it, but there is no guarantee that the filters installed by the user can. Timestamp accurate seeking certainly isn't a guarantee with all filters. The name DirectShow is quite appropriate, it's not DirectEdit.
If you really want this, it is probably easier to use a stand-alone parser and decoder (like for example avidemux). At least then you can keep the timing completely in your control.
multicone
7th June 2006, 19:55
Try gstreamer .... there is even a win32 version available now.
Sharktooth
7th June 2006, 20:31
yep, i was just about to suggest gstreamer.
it works pretty well too... :)
MasamuneXGP
9th June 2006, 05:29
Thanks for the advice guys. I took a brief look at avidemux, and it appears to be VirtualDub for MP4s. Kinda not what I want, although I haven't looked at it in depth yet. What I want is a library of audio data/video frame extraction functions to replace the vfw functions. Does avidemux fit that category? What about gstreamer?
multicone
18th June 2006, 23:03
What you want doesn't exist as of yet. It would be either the long planned CoreAPI or the already long ago died UCI (Universal Codec Interface), built on gstreamer or any other suitable x-platform multimedia framework.
Kostarum Rex Persia
18th June 2006, 23:54
I do not understand what gstreamer is? Can someone explain that to me. Thanks.
Drachir
19th June 2006, 07:06
I do not understand what gstreamer is? Can someone explain that to me. Thanks.
http://gstreamer.freedesktop.org/
XmSurfer
19th June 2006, 10:11
The list of media framework alternatives include:
Helix (Cross-Platform, Open-Source, Backed by RealNetworks, In use in mobile phones in addition to PC's)
GStreamer (Cross-Platform, OSS)
QuickTime (MacOS & Windows)
Directshow (Windows only)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.