best way to build graph for MPEG2 transport stream

2019-02-14 22:11发布

on windows 7 the windows media player supports .ts files very well, in the sense that windows media player knows how to handle such files without any additional codec packs.

however if I try to use graphedit to "render" a .ts file, it complains it doesnt know how to build a graph for it.

what method does windows media player use to demux/decode these files? is it directshow? windows media foundation? BDA? Microsoft TV Technologies? unified tuning model?

whatever the method they use, is available as an API to be used in my custom application?

2条回答
可以哭但决不认输i
2楼-- · 2019-02-14 22:57

I'm not sure of the method used by Windows Media Player.

I've used DirectShow to build a graph. From the source, you can add an MPEG-2 Demultiplexer, create the Audio and Video pins (using the IMpeg2Demultiplexer interface), then hook the Audio pin to the "Microsoft DTV-DVD Audio Decoder" and the Video pin to the "Microsoft DTV-DVD Video Decoder". You can then feed the outputs into an audio and a video renderer.

For example, here is part of a graph I have used: Render Graph

David

查看更多
该账号已被封号
3楼-- · 2019-02-14 23:08

In DirectShow using only Microsoft filters it can be a bit of a mess. The Mpeg2 Demultiplexer needs to be manually configured through code using the IMpeg2Demultiplexer interface or through the property pages to add output pins for the content streams. Normally you would need to connect something else to the filter to parse the PSI/PAT information and identify the program ids of the content streams inside the transport stream. Microsoft provides an SDK sample to do this in the Windows Platform SDK.

This is assuming that you have a regular mpeg2 transport stream file. You can use the free apps MediaInfo or TsReader Lite to see exactly what is in your ts file.

There are non-Microsoft filters that make handling transport streams in DirectShow a lot easier. The combination of the open source filters Haali Media Splitter and Ffdshow will do it without any extra configuration. Or commercial filter packages from MainConcept, Elecard, LEADTools, etc.

I haven't done much hands-on work with Media Foundation, so I don't have much advice to offer on that front. Newer versions of Windows Media Player use MF instead of DirectShow. Some, but not all, new MF functionality is also exposed through DirectShow interfaces.

查看更多
登录 后发表回答