ms-media-foundation

Audio sample adding to a video using Sink Writer in Windows Media Foundation

Deadly 提交于 2020-01-06 02:08:05
问题 I can write a video file using images which I learned with this sample here. It uses IMFSample and IMFSinkWriter . Now I want to add audio to it. Suppose there is Audio.wma file and I want this audio to be written in that video file. But cannot figure out how to do that in this sample. Things like input & output type setup, IMFSample creation for audio buffer etc. It would be a great if someone could show me how to add audio to a video file using sink writer. 回答1: Media Foundation is great to

HEVC VIdeo Extensions keep taking memory until UWP app crashes

帅比萌擦擦* 提交于 2020-01-03 04:16:19
问题 I am using HEVC Video Extensions in order to decode video on my UWP video app. The problem is that the HEVC app takes so much memory during playback that I am unable to play large 4k files without crashing. If I use the HEVC hardware only I am able to have better use of memory but limited in 4k on it. I have tried HEVC Extension and tried to see if there is garbage cleanup I can do but have not been successful in lowering the memory Just setting my video like this: MediaSource ams_02 =

How to create IMFSample from D11 texture for Intel MFT encoder

故事扮演 提交于 2020-01-02 15:27:42
问题 I want to encode video using the "Intel® Quick Sync Video H.264 Encoder MFT". If I create IMFSample from system buffers, it works well. Just like following: IMFMediaBuffer *pBuffer = NULL; MFCreateMemoryBuffer(cbSize, &pBuffer); BYTE *pData = NULL; pBuffer->Lock(&pData, NULL, NULL); memcpy(pData, bufferIhaveinYYYYUV format, buffer size); pBuffer->Unlock(); IMFSample *pSample = NULL; MFCreateSample(&pSample); pSample->AddBuffer(pBuffer); Now I'm investigating whether I can feed it

Video Recording Hangs on IMFSinkWriter->Finalize();

为君一笑 提交于 2020-01-01 05:34:11
问题 I have an issue when finalizing a video recording into an .mp4 using Media Foundation where the call to IMFSinkWriter->Finalize(); hangs forever. It doesn't always happen, and can happen on almost any machine (seen on Windows server, 7, 8, 10). Flush() is called on the audio and video streams before hand and no new samples are added between Flush and Finalize . Any ideas on what could cause Finalize to hang forever? Things I've tried: Logging all HRESULT s to check for any issues (was already

How do I grab frames from a video stream on Windows 8 modern apps?

自作多情 提交于 2019-12-31 12:08:28
问题 I am trying to extract images out of a mp4 video stream. After looking stuff up, it seems like the proper way of doing that is using Media Foundations in C++ and open the frame/read stuff out of it. There's very little by way of documentation and samples, but after some digging, it seems like some people have had success in doing this by reading frames into a texture and copying the content of that texture to a memory-readable texture (I am not even sure if I am using the correct terms here).

Bug in IMFSinkWriter?

旧街凉风 提交于 2019-12-31 05:40:06
问题 I implemented an encoder in 2 ways. 1) based on the SDK Transcoder example, which uses topology and transcoding profile 2) based on IMFSourceReader and IMFSinkWriter, where the Sinkwriter delivers the samples to the Sourcewriter for transcoding I tested both implementations on Windows 8.1 with Nvidia (Quadro K2200) and Intel GPU (P4600/P4700) But bizarrly only the topology implementation uses GPU (on both). In 2) I both I set "MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS", which has not to be set

Media Foundation IMFSinkWriter::Finalize() method fails under Windows 7 when muxing H.264 frames into MP4

不问归期 提交于 2019-12-30 11:10:47
问题 I'm writing a tool in C# that muxes H.264 frames into MP4 files, and I'm using Media Foundation's media sink with sink writer to do this. Things work pretty well under Win8, but under Windows 7 the same code throws an exception, HResult: 0xC00D36E6 (MF_E_ATTRIBUTENOTFOUND), when invoking sink writer's Finalize method. As a result, the generated MP4 file is not properly closed, and is (of course) not playable. The mftrace log shows that the failure under Windows 7 occurs somewhere after (or

Media Foundation get encoded bitrate

陌路散爱 提交于 2019-12-25 07:54:56
问题 I am trying to get the encoded bitrate of an audio file (mp4, m4a, aac) using Media Foundation. What I did is: PROPVARIANT prop; IMFSourceReader* reader; MFCreateSourceReaderFromURL(filePath, NULL, &reader); reader->GetPresentationAttribute(MF_SOURCE_READER_MEDIASOURCE, MF_PD_AUDIO_ENCODING_BITRATE, &prop); The second line ends with an error and with empty PROPVARIAT. However, when I do: reader->GetPresentationAttribute(MF_SOURCE_READER_MEDIASOURCE, MF_PD_DURATION, &prop); It works fine. Does

IMFSourceReaderCallback: base class undefined

倾然丶 夕夏残阳落幕 提交于 2019-12-24 17:02:06
问题 I am having some trouble reading samples from a video camera via Media Foundation. I am following the example in the windows SDK samples folder MFCaptureToFile. My class is set up correctly to inherit from the abstract IMFSourceReaderCallback class, as far as I can tell: #include <windows.h> #include <mfapi.h> #include <mfidl.h> #include <mfreadwrite.h> class WinCapture : public IMFSourceReaderCallback{ public: static HRESULT CreateInstance( std::string deviceName, WinCapture **winCapture );

Read Second audio track stream from mp4 file using SharpDx or IMSourceReader

烂漫一生 提交于 2019-12-24 14:18:43
问题 I have a requirement in my application where I have to read all the available track stream from mp4 file. Mp4 file is encoded with number of tracks in AAC format. I have to decode to get all available tracks from the file. Currently I am using SharpDX and IMSourceReader (Media Foundation dlls) to read the Streams. But by default SourceReader returns only the first audio stream from the file. Is it I am doing correct ? Or I have to use any other third party libraries to achieve this ? 回答1: