I've develop an html5 video player with dash.js that plays streaming mpeg dash content. It works great.
Now I have a requirement to run the same on WPF. using an webbrowser to run my already developed html5 sounds very dirty but I can't figure what I can use to make streaming work.
any tips?
There exists no DASH player library for WPF that I am aware of.
#Sander is right, there doesn't appear to be a WPF or C# Dash implementation at this point.
Microsoft's documentation on building a player suggests using dash.js
I'm also not an expert with WPF and have no experience playing video of any kind within WPF. That said I assume you should be able to do something similar to the way dash.js works with the HTML5 Video element. This would require you to do a number of different tasks like parse the MPD file format, and download the required segment(s).
The simplest implementation of this would be simply parsing the MPD and finding one specific bitrate / resolution BaseURL and passing those values to a WPF element that can handle playing mp4 files. However to really get the benefits of DASH you would need to fully parse the MPD file and implement logic around bitrate switching, etc.
Related
This is one of those messy real world problems. I have a device that provides two video stream of 1920 x 1080 # 30 FPS. I have the documentation and the SDK for the video device which is unmanaged, naturally. It support GPUDirect. We have tested a SDK which is a SharpDX/SlimDX/DirectShow.Net type wrapper basically around DirectShow for our purposes. Licensing legal issues may prevent the use of this SDK. Being new to this world I am trying to piece together an alternative solution.
The question is the sample I have appears that they take the frame buffer in a surface and apply that to the input pin of a filter. After that is a mystery. I see the video in a a WPF window, can overlay text etc. is DirectShow the best or most direct way to display streaming video or will I find that using DirectX and shaders using say SharpDX easier?
I understand the question is broad in nature but I believe there are many others who are faced with this myriad of tools but do not have enough experience in this graphics world to make the best choice and look to those who have gone before to nudge us in the right direction.
Opinion based questions are basically considered off-topic, so I am skipping that part and besides that,
DirectShow and DirectX are working together only at the point of presentation of video. Video Mixing Renderer 9 and Enhanced Video Renderer components are utilizing Direct3D to present video. That is, you are supposed to choose the most appropriate for you: you either work with DirectX directly, or you are using DirectShow's "gate" to Direct3D.
Then DirectShow itself, you typically use it when you have a source interfaced as DirectShow filter, or you need to apply other DirectShow filters for processing, or you would like to synchronize video and audio, or you otherwise have a good reason to use capabilities of DirectShow in terms of using available components. If you have a video feed comping from non-DirectShow sources, then you need to deliver that into non-DirectShow destination then you might prefer to not use DirectShow at all. DirectShow and Media Foundation are primary APIs for video streaming and those you mentioned are merely wrappers.
I would like to consume a Motion Jpeg stream from an IP camera and ideally view it using the media element. I was hoping to find some ready made samples.
There is a really nice example (and controls to download) from channel9. Check visit here
Unfortunately the provided dll is out of browser only which I suspect will be a bit of a downer.
Without the use of native dlls, transcoding the meterial on the fly on your server is probably your best - if not only - option.
I would like to port an ActiveX of mine (to Silverlight) that have the following features:
Embedding a logo image in any video file.
Embedding subtitles in any video file.
Cropping any video file (for example: cropping 10 seconds of a 1 min. video).
Save the video file result (by the current encoders of the client).
The current ActiveX uses DirectShow - unfortunately, it can't be used in Silverlight. How I can abandon the old ActiveX technology for the new Silverlight technology?
The simple answer is: you can't.
Silverlight is targeted at two main types of apps:-
Content presentation, be that Video, Audio and Images, all with a view of creating interesting and engaging ways to interact with this sort of content.
More recently Line of Business apps, that is data entry and data presentation. Again with a view to making this at least a little bit more visually stimulating than prior technologies made these sorts of apps.
Video editing doesn't really fall into either of these camps and is not catered for.
I'm not sure its yet true to say the ActiveX is old, after all what technology is used to host the Silverlight Plugin in Internet Explorer? ActiveX.
I don't know if that's going to be easily doable. The various codecs natively available to Silverlight are all wrapped by the Silverlight MediaElement control, and so far as I can figure out, they're not directly exposed through an API, e.g., you can't get at the raw decoded RGBA bitstream. (If I'm wrong on this, I'd love to know, but I've poked around, and I can't figure out how to do it.) The Mono source tree has a decode-only implementation of the Dirac codec, but nothing that would easily let you decode, e.g., WMV or AVI files, so far as I'm aware.
And even if you could somehow grab the raw, decoded RGBA (or YCbCr) bitstream, so as to be able to insert whatever data you want into those frames, you'd still have to re-encode the video stream as well, and Silverlight doesn't provide any native support for that. You'd have to write your own encoders (not at all trivial), port them from the ffmpeg library (also not trivial), or wait for someone else to do it.
In short, my suspicion is that you're going to need to stick with your ActiveX solution for now -- though with some clever JavaScript coding, it might be possible to wrap that in a nice Silverlight UI.
I am trying to play a movie (wmv,avi,mpg,etc.) in a winforms application. I would like the user to be able to start, stop and pause.
I'm not looking for a full answer ... I just need pointed in the right direction. I've already did some searching on google but could not find anything useful. I can continue searching but I know the stackoverflow community rocks.
So, please point me in the right direction!
Thanks.
I think this is probably the path of least resistance:
http://msdn.microsoft.com/en-us/library/bb383953.aspx
You could use Windows Media Player ActiveX control.
You could also embed a WPF control that contains a MediaElement control.
Another alternative is to use the VLC library instead of Windows Media Player. The VLC Forums have a number of wrappers that can be used in C#.
I have not done a comparison of VLC versus Windows Media Player, but it is alot less resource intensive then the WPF media elements.
If I remember correctly VLC also has built in support for alot of video formats, potentially making it a better choice I guess.
One possibility is to use the Forms.WebBrowser class. This will give you an embedded web browser so you can install what ever player and plugins you need.
It depends on how complicated you want to get, but I've had luck implementing DirectShow before. It's definitely more complicated than a drop on control, but it's really flexible for different formats and loading codecs.
Are there any controls that anyone is aware of that I can use to stream firewire video into a WPF app. I do not need camera control or capture just the video. I need WPF hosting because I'll be adding WPF content on top.
I was hoping that with the addition of having direct X surfaces in WPF something like this might appear.
Ideally looking for something relatively high level (not a direct show guy at all).
Thanks,
Brian
There are a couple really good video rendering packages for WPF. This guy Jeremiah Morrill has a blog where he discusses his numerous render projects. There's the WPF Win32 render project, and a number of low-level techniques he documents for how to access accelerated playback, Media Foundation .NET, DVD controls, etc... I believe his blog is titled "Jer's One Stop Shop".
Reading over his blog in general is a good idea if you are in to video/WPF. Last I checked, "MediaKit", one of his more comprehensive projects, enables easy use of DirectShow (simple xaml and your off and running, so don't worry) and other well known native interfaces. It's very robust and actively maintained, if not that specific project, check into some of the recent API's he's contributing on, some various Win7 media support also.
The only reason I'd bring up this other project, Augmented Reality, is that you remarked about adding content "on top". You should definitely check out wpfAugRel if your doing a lot of video production. Where to get an add on for it eludes me, but I'm sure you can find it off that site, but it allows for you to script in python some fairly slick real-time video production.
-- edit --
Right, look at this google code page, it has some video's (picture's worth a thousand words right?), but regardless, it allow's you to mix in 3D content into live-action, through the use of "marker" prop's, essentially bit's of paper with some easily machine recognizable feature's, that facilitate their underlying engine to inject computer rendered output into a real world scene, highly dynamic, so you can toss these marker's around and the 3D content move's fluidly... anyhow good luck.
Check out this article by UberDemo. It captures video into a WMV file with Windows Media Encoder and WPF. There is a paragraph about how to do the preview in a WPF application.