Using Microsoft DTV-DVD Video Decoder to play H264 video - filter

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.

Related

NVEnc Directshow Filter [NVIDIA VIDEO ENCODER FILTER]

I could successfully use h264_nvenc in ffmpeg to record my video source using nVidia.
But I need Pause/Resume the recording.
Which seems not possible with ffmpeg.
Suspend ffmpeg process pause the video frame but file continues.
So I need a directshow filter with h.264 nvenc support to use in my application.
I need .ax or .dll directshow filter to test in graphedit.
I couldn't anything on the net.
Could some expert help me to get a directshow filter or some clue ?
Check this link:
https://www.codeproject.com/Articles/421869/H-264-CUDA-Encoder-DirectShow-Filter-in-Csharp
That seems to be a DirectShow filter built with C# which encodes H.264 using NVIDIA CUDA API.

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

Should I use the MP3 or AAC codec for a .mp4 file?

We have an encoding process in place using ffmpeg on Mac OS X. This process will take a source video and a couple files from that: .m3u8 video, .mp4 video and .mp3 audio file.
By default we've used the video from our m3u8 process which is a h264 (via libx264) video with AAC (via libfaac) audio.
We are mostly using these videos on mobile devices (hence the m3u8 files) but we also use the .mp4 files for Android, Windows Phone, etc. More and more we also need to offer these same videos on the web via either a flash player or HTML5 player.
Therefore, we'd like to have the best audio/video codec combo for all these uses ... where I'm confused is to what is "standard" for a .mp4 file?
If the .mp4 uses the mp3 codec then it plays just fine everywhere but QuickTime, in QuickTime the video plays but there is not audio (works just fine in VLC player tho.)
I've been told it's due to how QuickTime uses file extensions to assume information about the video instead of trying to actually get the codec data from the file? This does make some sense, if we encode the same file but use AAC for the audio codec then it works just fine in QuickTime.
So --- what's the "correct" or "ideal" audio/video codec combo --- is it best and safe to use AAC (i.e. will it work on a broad range of devices) even though it's not a "free" codec?
Compatibility issues set aside, you might want to take into account the quality loss induced by transcoding from mp3 to aac. As your original audio is mp3 encoded, you will have a better end result by remuxing the mp3 bitstream instead of transcoding to aac (even if aac is better than mp3 at a given bitrate).
If your workflow requires lowering the bitrate of the original mp3, then my point looses relevance.
AAC is preferred because many modern devices such as tablets and mobile phones might have hardware decoders for it which will result in better battery and lower CPU consumption. Same applies to h264.
In recent years a growing number of devices have added hardware acceleration for the (HEVC) H.265 codec, but that's probably about ~half of the mobile market at best so not yet a default.
http://en.wikipedia.org/wiki/HTML5_video - scroll down for a compatibility table. Seems like either MP3 or AAC work well with H.264
Definitely use the AAC codec, as you said, it works on a wider range of devices and it is better for use in HTML5

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.

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