1/04/2022

DirectX GraphEdit Decoding H.264 from Elgato Game Capture HD S-Video

The default DirectShow [MPEG-2 Demultiplexer] worked for the AverMedua C874 once I understood it was in push mode and pushing a TS stream. The PSI and stream IDs had to be mapped to output pins and then the Graph Editor could render the decoded streams.

Similarly the Elgato Game Capture HD was also pushing a TS stream, but made of H.264 video and AAC audio.


 

The trick to getting it to work was to abandon the default Microsoft provided [MPEG-2 Demultiplexer] and manually registering an ArcDemux.ax filter that came with another software package installed on my system. Then it showed up in the available 32 bit Directshow filters in Graph Edit.

 

The Arcsoft ArcDemux filter was not registered with the system for general use.. but filters provided by software makers can be directly referenced by-passing the registry and keeping them somewhat hidden.

The ArcSoft Demux filter has additional media types for both H.264 and AAC, which the MPEG-2 Demultiplexer did not. The C874 had a different type of audio that was supported by default as MPEG Audio 1.

Its also important to be aware the device driver filter for the Elgato Game Capture is 32 bit and shows up under the global Directshow filters list, not the WDM capture devices. On Win7x64 Graph Edit often crashes if you attempt to open the Directshow list.. probably due to some errors in the registered filters for 64 bit Graph Edit. The work around is to use Graph Studio Next or some other Graph editor to get all the filters on one graph,s ave to a file and then open it in the default Microsoft Graph Editor program.

This is still just a proof of concept . There are minor issues.

Audio and Video are clearly captured and provided from the TS pin.

But the auto-rendering function of Graph Edit pulled in some collateral filters from other programs, like the Hauppage AAC filter. It can probably be better optimized to use specific filters.

The Graph file saved also doesn't appear to preserve the PIN assignments and they have to be reassigned upon loading the Graph again.. very strange behavior.

There is also some "drift" in lip sync with this first attempt at a Graph.. possible due to all of the extra filters building out the audio chain.

 

 



Instead of a general purpose Proc-Amp panel like with many other capture devices. Elgato provides a custom popup dialog box when right clicking on the Elgato Game Capture HD filter. It allows many other things than Proc-Amp controls like capture format, audio levels and so on.




This is with the 11/6/2015 2.3.3.42 device driver version. Earlier versions did not include a TS pin as an option for accessing the audio/video stream for Preview or Capture.

In fact misusing the TS pin to provide a Preview of the video stream being captured is kind of weird.. since normally that stream would be sent to a file filter or dumped to a file for storage as a raw .TS or mp2ts file stream. TS is a lossy or packet loss tolerant format which is often used for broadcasts, or in situations where packet of audio or video can be loss and not abort the flow.

Generally "after" the TS stream is captured, to render it suitable for a DVD or long term file storage its more common to transcode or convert it to the PS format and put it in a structured container with meta tag data like a generic file with extension .MP4

The other pins provide uncompressed Video and Audio.. for more immediate Preview use, but at the cost of being less reliable than the TS stream for capturing everything during a capture session.. this is by design as most WDM capture devices offer a tight but laggy capture stream and a fast but lossy capture stream for preview.

In theory this same approach should work with the more current HDS and HD60 versions of the Elgato Game Capture for use with HDMI capture.. but I do not have those products and have not had an opportunity to prove it works with those devices.

A bit of proof it is Interlaced video that is being captured, and with a smaller graph, fewer filters.



Gotta love that there isn't chunky 64x64 Macroblock artifacts, those are Interlaced lines between fields being mashed together into a single frame. The motion blurring is due to the difference in time between the two fields.

The Elgato property page for the capture filter says its capturing in Interlaced 59.97 fields per second (fps) but is nice to get visual confirmation.

Its also a great example of why its better to always capture SD NTSC video in "Interlaced" format.. that image is "mashed together" into one frame and now its impossible to pull it back apart into Interlaced format and try again.. its irretrievably "baked into" the Progressive frame by frame format now.

Truthfully I  should not be pulling the Preview off the MPEG-TS pin, normally you want to store that in a capture file and pull Preview video off the plain "video" pin.. which has a  lower priority and can deliberately drop frames in order to sacrifice the Preview video, in order to always capture every last bit from the MPEG-TS pin at capture time. - That's how the Capture filter/plugin was designed to work in the very beginning by the Microsoft standard.. anticipating people would want to "See" what they are capturing during the capture process.

It was a little controversial and forward thinking at the time since slow CPU and hard drives made it difficult if not impossible to "do two things at one time".. both Preview and Capture.

PC's and hardware eventually caught up however.

Back in the day.. a separate video audio "splitter" or "video distribution amplifier" was used before the capture device to feed a separate video monitor and speakers.. so you could "see" what you were doing.

Ironically.. for a different reason.. but Game Capture would do this .. for different reasons later.. the hardware encoding takes time and adds lag to both the Preview pin and the Capture pin.. so to avoid "game lag" they would try to pass-thru a copy of the raw video feed either though the game capture device.. or do the same thing and use a hardware video distribution amplifier up front before getting to the capture device.