I am using directshow to transcode AVI videos from one format to another.
The target format is x264 and I am using using ffdshow as the encoder.
Decoding within the filter graph is not a problem, nor is encoding as everything works.
However, when I select the "ffdshow Video Codec" (FriendlyName) I get a IBaseFilter that encodes in
xvid, not H.264. Does anyone know how to either, (a) set the default encoder from xvid to H.264 or
(b) programmatically choose the H.264 format, (c) anything else that will work.
+ Reply to Thread
Results 1 to 6 of 6
-
-
Thanks for responding poisondeathray. ffdshow uses the x264 encoder internally.
If I understood you correctly you are suggesting that I use one of the tools you mentioned but my requirements do not allow for manual intervention. The encoding has to happen automatically as video files become available for encoding, i.e. when they are copied to a specific directory my program has to pick them up and transcode them so I can't use GUI tools.
My problem is the overall workflow/process is working fine but it seems ffdshow's default encoding format is xvid and I don't know how to programmatically request H264 from ffdshow using the DirectShow API. I've used VirtualDub's ffdshow plugin and "Save As" to successfully convert an AVI to H264/x264 so somehow VirtualDub is working (but I think it uses the VFW API). So I am wondering if anyone has had a similar experience and knows how to either programmatically select ffdshow's H264 encoder using the DirectShow API, or knows how to configure ffdshow to use H264 as the default encoder instead of xvid using either the VFW Configuration dialog box or possibly by changing registry settings.
Otherwise I think I have to look at creating a custom DirectShow filter that calls the x264 encoder, use VFW API instead, or something else but these are potentially very time consuming options as everything but the encoder selection is working for me now.
Any help is appreciated. -
While it's true you can encode h264 with ffdshow (and it's based on x264), it's implementation is very poor. (make sure you adjust the settings if you use ffdshow, the default settings are very low quality - at minimum, at least turn on in-loop deblocking) Anyways...
If you configure h264 in the drop down box in the VFW configuration in the encoder tab, push apply + ok, it should replace xvid as the default
I think ffdshow, when used as an encoder is VFW only.
Is there not a work-around that you can use instead of ffdshow to encode? What program are you using? x264 is a CLI encoder, you don't have to use a GUI.
Also, I'm not sure what "IBaseFilter" is that you mention in your first post. It could be that you have multiple codecs and some conflicts occurring. One option would be unregistering or cleaning up some codecs/filters
-
My problem is solved !! Thanks for your help. You actually helped me out by confirming that the default format in ffdshow is set via the encoder configuration. That's what I thought originally but when I was getting xvid I questioned it.
As far as your work-around question, it would have been difficult to use something other than ffdshow because the whole project was based on it and I didn't have time to switch. However, it didn't really matter because it turned out that the problem was with my code and with how DirectShow attempts to add filters automatically where it thinks you need them.
You asked about IBaseFilter (this is DirectShow programming stuff). IBaseFilter is the COM interface (Microsoft technology) that represents a DirectShow filter. The way DirectShow works is you have to create what's called a filter graph using the IGraphBuilder interface. Usually the first thing you put in the graph is an audio/video file or real-time input from a camera (frame-grabber), i.e. your source. Then you fill the filter graph with one or more filters and then run the graph to get whatever result your looking for. Each filter represents a part of the process. You can build a filter graph that plays/displays an AVI file, transcodes an AVI to another format (as in my case), etc. To make the graph work, each filter or process step must be connected by "Pins", either input or output pins (represented by "->" in the below example). So in the case of the video transcoding graph, it follows these steps:
Source AVI -> AVI Splitter (to separate video from audio) -> AVI Decoder (to decode original source file) -> ffdshow Video Codec set to H.264 (to encode to new format) -> AVI Mux (to create the AVI wrapper [and to add audio back if wanted]) -> File writer (to write the file to disk)
Setting up these steps in this order is what solved my problem. Prior to this I was missing some steps and DirectShow attempted to complete the graph by filling in my process gaps. This resulted in the xvid transcoded file.
The tools that were invaluable to helping me solve this problem were Microsoft's GraphEdit tool which allows you to graphically build these filter graphs and test them via its GUI. GraphEditPlus is even better and includes a C & C++ code generator that can produce code per your graph design.
I hope I'm not being too wordy here but perhaps this might help someone else that hits a problem like this.
Thanks again for your help ! -
Guys,
I'm encoding an AVI file into MP4 format with the x264vfw codec (H.264) using the graph shown below.
I can play the encoded output file with Windows Media Player just fine, I get both audio and vido so that means I have all the playback codecs installed properly but when I try to play it inside Adobe flash player 10 there's no audio, there's only video. Any ideas why?
btw, I'm new to this stuff so please go easy on me!
Thanks.
Similar Threads
-
h.264 encoder with directshow support
By sampalmer21 in forum Video ConversionReplies: 1Last Post: 3rd Nov 2009, 09:52 -
...setting webcam's parameters programmatically
By alexjep in forum ProgrammingReplies: 0Last Post: 12th Dec 2007, 11:36 -
h.264 digital format to PAL, SECAM, NTFC formats in DirectShow ?
By manzoor505 in forum ProgrammingReplies: 1Last Post: 8th Dec 2007, 08:28 -
ffdshow H.264
By AuroEdge in forum Software PlayingReplies: 1Last Post: 19th Oct 2007, 00:15 -
flv transcoding programmatically
By YoKnows in forum ProgrammingReplies: 0Last Post: 15th Jun 2007, 10:27