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

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.

Related

How to get Live video stream from Epiphan to VLC player?

Is there any way to get the live stream from the Epiphan device using Epiphan SDK to play the same in VLC or ffplay?
Using EPIPHAN SDK, I am able to grab the frames and also their SDK provides a way to convert the frames to GUI but i am not able to find a way to get the live stream of video.
Does ffmpeg lib provide a way to do so?
NitinG,
You don't need SDK itself for that. Epiphan driver already exposes the device via DirectShow/V4Lx interfaces (depending on the OS). It basically looks like a camera for VLC or ffmpeg. Start VLC and go to "Media"->"Open Capture Devices".
You need SDK only if you want to have programmatic access to more advanced, low level features that are difficult to expose over DirectShow or V4Lx interfaces.
Cheers.

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 can I playback an audio stream from a Icecast on WP7

How can I playback an audio stream from a Icecast on WP7
I have tried SMF, SmoothStreaming Client and the MediaElement.
None of these have worked. The formats are either asx or and wma.
Edit:
Recently I found a new stream. this stream works when I'm in the designer. But it does not work on the device. On the device the stream is opened and closed immediately.
this stream is from an IceCast server in MP3 format. with a ?.mp3 extention. or without.
When you are streaming live radio, the stream may be encoded by an IceCast server or ShoutCast server. To read these streams, you will need to decode the stream in memomry and pass it to the MediaElement once it has been decoded.
have a look at Mp3MediaStreamSource
and Audio output from Silverlight
I lost tons of time on this, and this is the best solution I found so far.
Having had a quick look at the Icecast web site (I'm not familiar with their service) it seems that most of what they offer for streamed audio is offered in MP3 format, but that they provide this as playlists in either M3U or XSPF format. You can't provide this to any of the built-in controls or classes in the WP7 framework, but you can parse the contents of the file and pass that to a MediaElement to play individual files.
The M3U file is a simple list of the consituent URLs, so is the simplest to deal with, but the XSPF format (which is an XML format) provides more information, such as the title. You can easily use the XDocument class to parse the XSPF file and then use LINQ to query the contents.
You're not adding the ?.mp3 to the pls file right, to the embedded URL? IF you are using the URL you get from the PLS/M3U file, you might need to append a file extension to it. You can often do this by adding ?ext=.mp3 or ?file.mp3 to the URL and it should play with MediaElement, as I read on the MS dev boards that people had been getting that to work with Shoutcast streams.
Does your stream work on the device when you unplug it from the computer? Media playing doesn't work while you're plugged into the Zune sync center.
Chris

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.

How to receive MPEG-TS multicast from Windows

We currently have a system with live video encoded to an MPEG-TS multicast stream, being received by televisions with STBs. In addition to televisions we'd like to embed the video in our Windows application.
I know that VLC will receive the stream, but would prefer both a solution that I can embed in an existing application without playing window moving games, and one without licensing problem. I realize that likely means that I'm not looking at a free solution, that's fine, within reason.
Anyone know of a good product for this? Either something easy to use, or a plug-in for WMP.
You'll need to develop a simple DirectShow filter that listens on a given port and just passes down every packet it had received.
I don't have a sample handy, but it's really simple, several hundreds lines of code.
Then you just connect this filter to an MPEG2 Demultiplexer capable of decoding transport stream.
NVidia and Elecard come to mind first, though the former one does not connect under debugger.
Then you connect the demultiplexer to the decoder and finally to the renderer.
The demultiplexers and decoders handle the live stream issues well, you just capture the UDP packets and send down to them.
Due to licensing issues, MPEG2 decoders cannot be free (ffmpeg and VLC violate the license), so you'll have to buy the decoder.
Visit http://elecard.com, they have a nice range of MPEG2 products.
Expanding on Quassnoi's answer...
You might check out the Haali Media Splitter to act as a "MPEG2 Demultiplexer." This is a filter that just pulls the compressed video and sound out of the transport stream, so I'm guessing it doesn't have any licensing issues. Most PCs with a DVD player on them already have a licensed DirectShow MPEG2 decoder, so you can probably just use one that's already installed (or purchase a license from a place like elecard if you really want to be safe).
As you are developing your DirectShow application, you might find Monogram GraphStudio to be a helpful tool in designing the filter chains.

Resources