Click here to Skip to main content
15,793,452 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an existing C# Form project that I was asked to add the ability to display streaming video being put out by another process.
The video is a H264/TS encode stream.
I have read about emguCV (rapper around openCV), Solid FFmpeg (wrapper around FFmpeg) and then there is a wrapper around DirectShow as well. If I only need to decode the H264TS video stream what would you recommend I use and do you know of an example that uses it.
I was even thinking about reading the stream directly and decoding it myself and not use a third party dll.

Thanks in advance for any suggestions.

1 solution

I'm not 100% sure what would work, just because I use many different containers and formats and I always have the freshest support software installed, so, for me, it's hard to figure out what should happen if you have it all set up from scratch. So, please understand that and just try to follow my suggestions and tell me if one or another option.

First option is to embed existing Windows Media Player control. This is how it can be done: How to: Embed Windows Media Player on a Form[^].

Another approach would be embedding WPF player System.Windows.Media.MediaPlayer:
MediaPlayer Class (System.Windows.Media)[^].

Hosting a WPF control in a Forms application needs some extra effort. In many cases, it can be considered as a kind of overkill. This is how it can be done: Walkthrough: Hosting a WPF Composite Control in Windows Forms[^].

Now, the problem is the support of your stream. If you already have network streaming properly organized, you just set a right URI in the player. The problem might be the support of your container and codecs for H264. Frankly, I never remember which versions of Windows bundle what codecs by default, I just never rely on it; I can only say that "native" Windows support has been near-rudimentary; I never considered it as any decent. To work with Windows player, you can fix the codec support problem by installing the codec pack. Usually I recommend very comprehensive K-Lite Codec Pack:
K-Lite Codec Pack — Wikipedia, the free encyclopedia[^],
Codec Guide: K-Lite Codec Pack — For Windows 10 / 8.1 / 7 / Vista / XP[^].

(One side note: pay attention for the Media Player Classic Home Cinema which comes with it. I think it is infinitely better than any Microsoft player, but perhaps this is a matter of taste. :-))
Now, another alternative is not to rely on any Microsoft player. One such product is VLC (Video LAN):
VideoLAN — Wikipedia, the free encyclopedia[^],
VideoLAN — VLC: Official site — Free multimedia solutions for all OS![^].

It does not depend on the codecs installed on Windows, it host them itself, because it is based on libav library (as well as FFMpeg). Please see for more detail:
VideoLAN — Wikipedia, the free encyclopedia[^],
libavcodec — Wikipedia, the free encyclopedia[^],

You can use a .NET wrapper to be used in your application. Please see: download |[^],
C Sharp — VideoLAN Wiki[^],
ZeBobo5/Vlc.DotNet — C# — GitHub[^].

By the way, VLC can also be used as a streaming service itself (and has many other uses — this is not really just a player). Please see my past answers:
need help in getting the streaming video from an other computer in C#[^],
Preview selected file in Windows Explorer using C#[^],
Streaming music files in without WMP[^].

Share this answer
bccarey 27-Jan-16 8:04am    
Thanks you for all the information. I have read a lot about it but the way you laid it out makes all I read make more sense.
Not only did you answer my question on what to use I believe you also answered the question on what the different video solutions are.
I am currently looking at using ffmpeg because I was also told yesterday that they will need my code to put out each frames as a picture.

For anyone else reading this in the future I found the following link after reading Kryukov response and focusing on ffmpeg that I think you may find useful if you want to write your own wrapper like I do.

Again Thank you for your response.
Sergey Alexandrovich Kryukov 27-Jan-16 10:32am    
You are very welcome. Thank you for the link.
Good luck, call again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900