I'm using Windows Media Foundation to create a video file. I've got some code working based on the Using the Sink Writer to Encode Video tutorial.
When the input type in MFVideoFormat_RGB32
, and the output type is MFVideoFormat_WMV3
, and the sink writer is writing to a WMV file, and I provide the sink writer with top-down RGB32 data, I get the video that I'd expect.
When the output type is MFVideoFormat_H264
, on the other hand - everything else the same - the bitmaps come out upside-down.
How can I find out at runtime what sort of bitmap data is needed?
A media sink is the destination for one or more media streams. Media sinks fall into two general categories: A renderer is a media sink that presents data for playback.
Media Foundation is the next generation multimedia platform for Windows that enables developers, consumers, and content providers to embrace the new wave of premium content with enhanced robustness, unparalleled quality, and seamless interoperability.
Media Foundation provides a Media Session object that can be used to set up the topologies, and facilitate a data flow, without the application doing it explicitly. It exists in the control layer, and exposes a Topology loader object.
RGB video media types might be given an optional MF_MT_DEFAULT_STRIDE
attribute to specify row order:
Default surface stride, for an uncompressed video media type. Stride is the number of bytes needed to go from one row of pixels to the next. [...]
Stride is positive for top-down images, and negative for bottom-up images.
The attribute is optional and when omitted might lead to confusion as data consumer might apply different defaults. In general it is typical for RGB data to come in reversed row order for historical reasons, however most recent APIs tend to fix it and have data in normal row order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With