media-foundation | Repository for Windows Media Foundation related tools | Awesome List library
kandi X-RAY | media-foundation Summary
kandi X-RAY | media-foundation Summary
A collection of Microsoft Media Foundation sample apps along with tooling and documentation. Our goal is to share code samples, documentation, our favorite tools, and tips and tricks for troubleshooting Media Foundation issues.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of media-foundation
media-foundation Key Features
media-foundation Examples and Code Snippets
Community Discussions
Trending Discussions on media-foundation
QUESTION
I have multiple cameras in my Windows 11 system and I am wondering how to get all avaiable resolutions for them. I am not intending to make a video capture, but I am willing to just get these properties.
Also, I don't care which API to use, be it DirectShow or MMF (Microsoft Media Foundation). I haven't used any of these before either.
I have found multiple resources doing that in C# (as in here), but similar suggested answers for C++ are hard to understand - some code is given, but what libraries and 'includes' used is not given (as in here)
I have also checked DirectShow samples in hope something would be there, but I didn't find anything.
So, I checked MMF as well (1, 2, 3) and docs, but all posts seem pretty outdated and no full code is given showing how to use certain functions alongside proper 'includes', as trying the code gives me unresolved symbols.
So I am kind of stuck at the moment, I can't find a solution to this.
I would appreciate any help.
...ANSWER
Answered 2022-Jan-14 at 06:17Also, I don't care which API to use, be it DirectShow or MMF (Microsoft Media Foundation). I haven't used any of these before either.
You generally do care because the data might be different.
With Media Foundation, see How to Set the Video Capture Format
Call IMFMediaTypeHandler::GetMediaTypeCount to get the number of supported formats.
You might also want to have a look at Tanta: Windows Media Foundation Sample Projects and sample code there.
With DirectShow, see Webcamera supported video formats in addition to links you found; you will have to sort out includes and libraries through, among SDK samples AMCap does some one this and can be built from source without additional external libraries, from original code or from this fork adopted to most recent VS.
QUESTION
Using the Microsoft tutorial on Audio/Video Capture in Media Foundation, I try to create a media source for a video camera. Code below is directly taken from the aforementioned tutorial:
...ANSWER
Answered 2021-Aug-03 at 15:18In my case, the culprit was a disabled service: Windows Camera Frame Server.
I had to enable it (Automatic startup) through the Services application and start it:
After that the error did not occurred again.
On a related note, I also had to allow applications to access the camera:
Local Group Policy: Computer Configuration / Administrative Templates / Windows Components / App Privacy
"Let Windows apps access the camera" must be set to "Not configured".
QUESTION
I'm having some problems with MPEG1 videos and Media Foundation: So Media Foundation doesn't support playback of MPEG1 video streams (see here), but for some reason it will still open them and it will even report the correct duration and frame size. So at opening time everything looks like it can play those files.
But it can't! Once you try to actually play the MPEG1 video file, IMFAsyncCallback::Invoke()
will be called with a status of MESessionTopologySet
and then IMFMediaEvent::GetStatus()
will return 0xc004f011 and that's about it.
So is there any way to check if a video format can actually be played by Media Foundation after opening it or is there any way to make Media Foundation only open files that it can actually play? Currently I can only tell if a file can be played or not by attempting to start playback and then see if it works or not which is somewhat inconvenient. I'd like to be able to tell if a file can be played or not much earlier.
...ANSWER
Answered 2020-Oct-31 at 13:09I have solved this now by using IMFSourceReader
. I have found out that trying to set the media type to MFVideoFormat_RGB32
will fail with MPEG1 video streams but it will work fine with MPEG4 so this is probably a feasible way to check if Media Foundation can actually play a file. In code, the solution looks like this:
QUESTION
I'm trying to run this code:
...ANSWER
Answered 2020-Sep-02 at 14:47as_wikitext = T
downloads the text with the wiki markup. By default, page_content
downlads the page with HTML markup. Fortunately, there are numerous HTML parser available, one of the best ones being rvest
. The following code downloads the page as HTML, parses it into an HTML structure using rvest::read_html
and then parses that into plain text using rvest::html_text
QUESTION
I've written this program to setup an HEVC decoder based on https://docs.microsoft.com/en-us/windows/win32/medfound/supporting-direct3d-11-video-decoding-in-media-foundation. Everything works fine until the end when I call result = decoder->SetOutputType(0, media_type, 0);
this returns the error MF_E_ATTRIBUTENOTFOUND
. I'm not sure what's wrong, this error isn't described in the SetOutputType documentation and I've only found a couple examples of HEVC decoding with MF and none of them describe an error like this.
ANSWER
Answered 2020-May-25 at 06:03Even though MSDN does not mention other input media type attributes in H.265 / HEVC Video Decoder, you need to set them as well. See H.264 decoder article on what attributes you need: MF_MT_FRAME_SIZE
and friends.
You can also use MFTrace SDK tool to check what attributes were queried and reported as missing immediately before you get the failure.
QUESTION
I am able to display a video stream from an mp4 video by writing byte samples directly to the Enhanced Video Renderer (EVR) sink (thanks to answer on Media Foundation EVR no video displaying).
I'd like to do the same thing but for a webcam source. The current problem I've got is that my webcam only support RGB24 and I420 formats and as far as I can tell the EVR only supports RGB32. In some Media Foundation scenarios I believe the conversion will happen automatically provided a CColorConvertDMO
class is registered in the process. I've done that but I suspect because of the way I'm writing samples to the EVR the color conversion is not being invoked.
My question is what sort of approach should I take to allow RGB24 samples read from my webcam IMFSourceReader
to allow writing to the EVR IMFStreamSink
?
My full sample program is here and is unfortunately rather long due to the Media Foundation plumbing required. The block where I attempt to match the EVR sink media type to the webcam source media type is below.
The problem is the setting of the MF_MT_SUBTYPE
attribute. From what I can tell tt has to be MFVideoFormat_RGB32
for the EVR but my webcam will only accept MFVideoFormat_RGB24
.
ANSWER
Answered 2020-Jan-07 at 20:19I needed to manually wire up a colour conversion MFT (I'm pretty sure some Media Foundation scenarios wire it in automatically but probably only when using a topology) AND adjust the clock set on the Direct3D IMFSample provided to the EVR.
Working example.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install media-foundation
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page