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

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.

Related

Dumping h264 stream into a mp4 container

I would like to know how can I dump the h264 raw stream from a network camera into a mp4 container file. I need to do it with C++, any library? can I do it by myself?
Thanks in advance,
Windows 7 and later has API that can write video containers. Search MSDN for Sink Writer and Microsoft Media Foundation. It is the successor to DirectShow. There is specific mention for support of MP4 file sink and H.264 video encoding/decoding. This is one option.
Check out libmp4v2 # https://code.google.com/p/mp4v2/
It is pretty straight forward to use.
HandBrake uses it. You can download source from # https://handbrake.fr/downloads.php for reference

FFmpeg Hardware Acceleration -> GPU + DirectShow

Is there a hardware accelerated version of FFmpeg (e.g. a version that utilizes the GPU)?
Also, does anybody use FFmpeg with GPU support? Possibly for scaling and converting video format? Or, for example, use DirectShow for image scaling and displaying images on surfaces?
If so anybody can provide small code samples?
There are some VDPAU accelerated codecs for unixes with nVidia card. There is also an mpegvideo_xvmc codec using XvMC that can decode MPEG-1 and 2 on X11 if the driver has support for it, and also some codecs using VA API.
For Windows, ffmpeg supports DXVA 2. If you want to use it with DirectShow, you should install ffdshow tryouts, since it provides the necessary DirectShow filter (and it also supports all ffmpeg filters, can display subtitles, etc)

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.

MPEG to AVI library

I am searching for a library that can convert MPEG to AVI.
Is there a good one for this purpose?
Thanks in advance.
(My program is written in VC++, Thanks)
(I am using DirectShow.But I don't know how to use it to convert MPEG to AVI ? I know how to build graph and render video that already has an appropriate codec)
You didn't specify the prog language you're working with so I will just mention ffmpeg.
http://ffmpeg.org/
libavcodec is very popular.
Your best best is to use a audio/video framework.
I would recommend the following:
Windows
DirectShow SDK
Media Foundation SDK
Quicktime SDK
Mac
QTKit Framework
Linux
GStreamer
If you need a cross platform solution I would recommend the commercial MainConcept CodecSDK, which has some of the best video codec implementations around.

Which video and audio format/codec should I use?

Environment: Windows XP/Vista, VS2008, C#/.NET 2.0, VideoGrabber.
Hi All,
I'm writing an app which captures cameras input and encodes them into a movie file (including sound).
My client suggests I encode the movie using the DivX codec. But it's not installed by default and it's not redistributable: Users would have to download, install and configure it themselves.
Is there a Codec available in default Windows (XP+) installations that I could use to encode video and sound? It must support compression. Ideally, I should be able to programmatically set basic configuration.
Note: I read this question but it doesn't actually address my needs.
TIA,
Is there a Codec available in default Windows (XP+) installations that I could use to encode video and sound?
About the best you can hope for is WMV2 (WMV v8). You may be able to encode it using qasf.dll.
The codecs you get for AVI in XP are all woeful efforts from the early days of ‘Multimedia PCs’: things like Cinepak and RLE, which are of zero use for modern full colour/resolution video, and Intel 4:2:0, which is only chroma subsampling, not really actual video compression.
If you need better than that you'll have to start embedding your own codecs, eg. from ffmpeg.
But it's not installed by default and it's not redistributable: Users would have to download, install and configure it themselves.
That's best anyway. Silently installing codecs onto a system is rather antisocial as there are often clashes between them and you could end up messing up other DirectShow applications. For example there are (at least) three different common DirectShow codecs that can handle “DivX” (which is really nothing more than MPEG-4 Advanced Simple Profile video plus MP3 audio in an AVI container): DivX, Xvid and ffdshow. Having more than one installed can be a recipe for bugs.
Not sure how useful this is to you, but I was trying to answer that very question just recently. This article suggests DIB, I420, or IYUV are supported on all platforms... at least in OpenCV. I had the least trouble with I420.

Resources