Media Foundation external codec support - windows

I have wrote a program using Media Foundation API that takes an AVI files and decodes it's video samples into uncompressed RGB frames.
Recently, I found an AVI file that contained both audio and video tracks, but the Windows Media Player was not playing the video track (audio was playing).
I tried to open the file with another player (Gom Player) and it suggested me to dowload additional codec pack: LEAD MJPG/MCMP Video Codec . After installing it the WMP started to decode and play video track. But after that I again was not able to decode the file using MF API.
My guess is that Media Foundation is limited to what Windows ships. Is that right?
Also, is a way to tell Media Foundation to decode using externally installed codec?

Media Foundation API offers extensibility however codecs acceptable by Media Foundation need to offer respective format: they should be available and registered as Media Foundation transforms. This is a rare case since Media Foundation is not popular overall and most of the downloadable codecs have DirectShow API interface, or Video For Windows API interface, but not the one for Media Foundation.
If you had a suitable codec, Media Foundation would have picked it up.
Windows Media Player attempts to play via Media Foundation or, in case of failure, falls back to DirectShow. This explains why downloadable codec fixes Windows Media Player but not Media Foundation.

Related

Encode & play video formats without 3rd party codec packs

We have built a windows based software system that allows users to import their own video for viewing in the software. It works fine for AVI and WMV as we use a windows based player. For encoding or playing to work with most common video formats we have to ask our customers to download a 3rd party codec pack, such as K-Lite or Combined Community Codec Pack. Many of our customers are not allowed to do this due to IT Management rules.
Are they are any suggestions regarding a player and encoder that can be built into our windows based software without needing 3rd party codec packs.
I am not sure if ffmpeg, handbrake, VLC can be used for this purpose.
Thanks. J
I would suggest MP4 with H264 + AAC/MP3
This works in any browser without any third party codecs AFAIK.
Give this a try HTML5 Video

How to play H.264 video in a win32 window?

I came across a H.264 video which i would like to play in my c++ application. Could anyone suggest what could be the easiest way of doing it? Or What library can be used for the purpose.
Thanks in advance..
Windows API are DirectShow and Media Foundation (mind availability across Windows verions). You need a codec installed in Windows to be able to play the file, stock codec is only provided with Windows 7 editions. A choice of third party codecs is available.
Another option is to use a different framework such as ffmpeg which includes support for container formats and decoders.

Is it possible to use the h264 and aac encoders that ship with windows 7 from directshow?

I see that windows 7 ships with an aac encoder and an h264 encoder. I'm writing a directshow application that needs to do video encoding. I think: "Great! Now I don't have to license a video encoder!", but then I read on to discover that these encoders use the new MFT api which seems to be incompatible with directshow, and there doesn't seem to be a wrapper filter like there is with DMO. Is there a way for me to use these filters in directshow? Maybe there's a wrapper I didn't find? Maybe I can access these filters as DMO's?
As far as I know the H264 and AAC encoders are only available using the Media Foundation APIs. See the Supported Media Formats in Media Foundation on MSDN. So if you want to make use of these you'll need to use WMF instead of or in addition to DirectShow. As far as I know there is now wrapper or adapter to get a MF graph into DirectShow.
The good news is that MF is much improved compared to DirectShow and offers very nice higher level APIs for video like the SinkWriter which make it much easier to write video to a file.

Using Microsoft DTV-DVD Video Decoder to play H264 video

I am trying to play an H264 video with graphedit on Windows 7 32bit.
Graphedit is unable to render the file.
I tried to mount the graph manually using the Microsoft DTV-DVD Video Decoder (also know as Microsoft MPEG-2 Video Encoder) but I could not connected the filters.
Here is the pipeline I tried :
File Source >> Microsoft DTV-DVD Video Decoder >> Video Renderer (or VMR9)
I also tried this :
File Source >> MPEG-2 Demultiplexer >> Microsoft DTV-DVD Video Decoder >> Video Renderer (or VMR9)
In either case, I could not connect anything to the file source filter.
The H264 video I am trying to play is the Serenity trailer I downloaded from here : http://www.h264info.com/clips.html
Do you have any idea how I could play the h264 video file with graph edit?
Thank you
For starters. That file is an mp4, so you need an mpeg4 demuxer filter, which Microsoft does not provide for DirectShow. MediaFoundation supports it natively, but that functionality is not exposed to DirectShow. There are commercial DirectShow filters available or the open-source "ffdshow" plus "Haali Media Splitter" will do it. If your project can use the open source products, that will also provide a decoder with wide-ranging compatibility.
Assuming you don't want to use ffdshow and instead get a demuxer from elsewhere, it may or may not work with the Microsoft DTV-DVD Video Decoder. I've seen erratic results with it. A lot of content it just doesn't want to play.
One other thing is that you will likely want to use the Enhanced Video Renderer in Win7 instead of VMR9. VMR9 is neutered in Win7 (compared to XP). It's no longer compatible with dxva hardware acceleration, and the scaling is limited to the ugliest mode.
Use the File source but connect it to Geraint Davies' free mpeg4 demux available at http://www.gdcl.co.uk/mpeg4/
If you then render the output pins of the demux, the video decoder will automatically be inserted. I just tried it with the video you mentioned and it works fine.

How to play MPEG-TS videos by DirectShow on Windows 7?

Our application uses IGraphBuilder::RenderFile to build filter graph. On Windows 7, this application can play MPEG-PS videos smoothly, but it cannot open/play MPEG-TS(transport stream) videos. IGraphBuilder::RenderFile returns an error code VFW_E_UNSUPPORTED_STREAM.
On my Windows 7, Windows Media Player can open/play those MPEG-TS HDV videos.
My questions are:
Is it possible to load/play MPEG-TS videos by DirectShow on Windows 7, with only filters installed by Windows 7? Because it is best for us not to ask users to install some third-party DirectShow filters.
If it is impossible, is there some popular codecs that can handle MPEG-TS HDV, and also fit in DirectShow at best.
Some more details I've tried:
I also tried GraphEdit in Windows SDK. It gave the same error when opening those MPEG-TS videos.
If I added one MPEG-TS video as a File Source(Async), its output pin was marked as Major Type: Stream, SubType: GUID_NULL, and cannot be connected to other filters, such as MPEG-2 Demultiplexer.
More frustrated, MSDN says MPEG-2 Demultiplexer does demultiplex both of MPEG-2 transport and program streams.
So, it is very likely that I missed something. After days of digging, I am now very desperate on this problem now. Any advices are welcome and appreciated.
Thanks
Fan
The reason why you can't connect File Source (Async) to MPEG-2 Demux is that the file source operates in pull mode and the MPEG-2 demux only supports TS in push mode.
Haali media splitter can demux MPEG-2 TS. If you don't want to force users to install it, maybe you can write a simple push-type file source filter and insert it manually into your graph.

Resources