View Full Version : ffdshow + graphstudio
Warrick.FitzGerald
5th June 2009, 02:50
Hi Guys,
I'm trying to use the ffdshow encoder to convert a file to FLV.
No matter what format I try to output it does not seem playable.
I'm sure I'm doing something silly here, but I'm not quite sure what. Can someone point me in the right direction?
http://img197.imageshack.us/img197/4575/ffdshowgraphy.png
Thanks
Warrick
You need to add an appropriate multiplexer between FFDShow and the file writer (I've not tried writing FLV's so sorry cant suggest a mux).
FLV1 is the type of encoding but you need to specify the "packaging" method.
TTFN,
Jon
clsid
5th June 2009, 11:36
I suggest you use Avidemux to convert your files to flv.
Warrick.FitzGerald
5th June 2009, 12:33
Thanks JonE. clsid, we're writing DirectShow code to do the conversion, so I need to construct the graph myself. Before I go down that road I want to make sure I can run the graphs manually myself.
I don't do much of this kind of work myself, so 1st I'm trying to get anything to work really.
Let's say I simply want to write out an uncompressed AVI. Why does something like this not work?
http://img514.imageshack.us/img514/6181/ffdshowgraph2.png
In theory that should work.
I knocked up an example, graph attached as image.
What does ring an alarm bell is the "(Adobe2)" that appears in the titles for the two MPEG decoder components. MPEG2 decoders can be a bit of a nightmare regarding self-protection, if you attempt to write to a file or insert a sample grabber then in one example the audio dissapeared, in another I just got black videos and another I got GPF's !
There should be no such problems with the standard Main Concept decoders - I use them - but the additional reference to Adobe may mean they are "special" versions that may be protected.
Try replacing them with the Ffdshow decoders (make sure you enable the MPEG options!) and also see if you have an alternative MPEG splitter you can try.
When you come to build a graph in S/W, if you add the components you prefer to use prior to calling RenderStream(), Windows will try and use those components first in preference to anything else on the system - this is vital to protect yourself against the user installing other compnents that just wont work.
If you are going to split the streams in order to preview during rendering then make sure you use the smart-T to split the streams and not the infinite-T, and also speed up encoding by switching off the graph clock.
And good luck - I didn't have any gray hair until I discovered DirectShow.
TTFN,
Jon
Warrick.FitzGerald
5th June 2009, 13:52
Wow, that's annoying. I see where your gray hair comes from now :)
I have Adobe CS4 installed which is where I'm guessing these "special" filters come from. By special I'm guessing it means they try their hardest not to play nice with anyone.
It seems you were 100% correct, by using he ffdshow video decoder, things have started working for me.
Oddly though, if I hook up the output of the ffdshow video decoder directly to the AVI mux - the output is playable. If however I connect the output of the ffdshow video decoder to the output of the ffdshow video encoder (set to output uncompressed frames) ... the output it not playable.
I can't see your graph yet as the forum says it's still approving your image, but I don't seem to be having much luck with the ffdshow encoder at all.
I wish I could find someone who's put together a few examples.
- Here's a graph showing how to encode an FLV using ffdshow encoder.
- Here's a graph showing how to encode a WMV using ffdshow encoder.
....
Just so I can see what MUX is being used. To further confuse me, I find posts like this - http://www.videohelp.com/forum/archive/how-do-i-programmatically-choose-h-264-encoding-ffdshow-in-directshow-t358811.html - what the user seems to take the output directly from the video and audio into a file without a MUX?
oi ... like I said, I see where the gray hairs come from :). Thanks for taking the time to explain though.
Thanks
Warrick
clsid
5th June 2009, 13:57
Here is an FLV muxing filter:
http://blog.monogram.sk/janos/2009/05/11/monogram-flv-mux-0920/
You might also want to give Igor's H.264 and AAC encoders a try instead of using ffdshow. The FLV1 (= H.263) format does not give very good quality.
Warrick.FitzGerald
5th June 2009, 14:32
Once again. MANY thanks, I finally feel like I'm making some progress here.
clsid, I downloaded Igor's H.264 filter and the latest FLV mux filter and they do seem to produce a playable FLV. I must however have some kind of colorspace issue .. or something of that nature because it doesn't seem to matter what source I use, it looks all garbled when I play the file. See image below:
http://img41.imageshack.us/img41/2609/flv.png
Just so I can see what MUX is being used. To further confuse me, I find posts like this - http://www.videohelp.com/forum/archi...w-t358811.html - what the user seems to take the output directly from the video and audio into a file without a MUX?
The standard file writer is just one possible component that can write to a file. The example you linked to is writing an MP4 file and it looks to me like the last filter is a combined muxer and writer.
I've installed the two Monogram components and it seems to work fine (see attached file - cant seem to work out how to put image inside this message). What is the format of the AVI file you are using as a source ?
TTFN,
Jon
I tried the FFDShow encoder (FLV1) in place of the Monogram encoder and that worked too.
Warrick.FitzGerald
5th June 2009, 16:43
JonE - RE: Mux + Writer, thanks, that makes sense.
RE: Image attachments, I upload the files to http://www.imageshack.com/ - that give you a URL that you can use in these posts. It would be nice if the images were viable immediately, but I can see how that leads to problems.
The AVI looks like it's contents are DIVX (see GSpot screenshot below), however I do have FFDshow set to decode DIVX 4\5 so it should be fine.
To avoid that complication I then found a raw \ uncompressed AVI and put the below graph together - as you can see I still get the same garbled output.
Sorry if this is a bit of Image overload, but I'd rather provide more info than less.
http://img245.imageshack.us/img245/3751/ffdshowsettings.png
http://img38.imageshack.us/img38/4686/dnaavi.png
http://img245.imageshack.us/img245/2455/dnagraph.png
Hi again,
Sorry for slow reply - bit of a monday-to-friday kinda guy.
The image seems as though it is slanted sideways - a classic symptom of something getting the "stride" (or the number of image bytes per row) wrong. Gspot is saying that the resolution is 399x266 - that is a peculiar resolution and I'd start to think that its the "399" horizontal pixels thats the cause - I'm assuming the final video playes correctly (as in plays, pauses, and you can set position) and its just the image itself that is wrong.
Usually horizontal resolutions are kept to multiples of 8, or maybe 4, but certainly not odd numbers; I think therefore something in the chain is not handling the horizontal resolution correctly. Did you generate the source video yourself ? If so, try a different horizontal resolution e.g. 400 (and, as in this case, keep the vertical resolution a multiple of 2).
TTFN,
Jon
PS : Agree about the images - on another forum (http://www.vintage-radio.net/forum/index.php) I use (also using vBulletin) attached images appear as links to an image so that the reader isn't forced to view all the images if the don't wish.
Warrick.FitzGerald
8th June 2009, 15:26
Well spotted Jon. If it's not one thing it's another. I switched to a source that had a standard size and all worked fine. I'd been using AfterFX to generate the content and it was sizing the frame to the image I was using as a background.
Thanks again for all your help, it's very much appreciated.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.