Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all 1079 articles
Browse latest View live

B frames in H.264 MFT

$
0
0

Hi guys,

When running Windows Media Foundation H.264 MFT on Win10,  I found that the PTS and DTS of same frame are not equal (pts get from IMFSample->GetSampleTime, and dts from IMPSample->GetUINT64(MFSampleExtension_DecodeTimestamp).

Below are the timestamps from the H.264 MFT encoded frames:

pts = 0, dts = 0
pts = 2, dts = 1
pts = 1, dts = 2
pts = 4, dts = 3
pts = 3, dts = 4
pts = 6, dts = 5
pts = 5, dts = 6
pts = 8, dts = 7
pts = 7, dts = 8
pts = 10, dts = 9
pts = 9, dts = 10
pts = 12, dts = 11
pts = 11, dts = 12
pts = 14, dts = 13
pts = 13, dts = 14
pts = 16, dts = 15
pts = 15, dts = 16
pts = 18, dts = 17
pts = 17, dts = 18
pts = 20, dts = 19
pts = 19, dts = 20
pts = 22, dts = 21
pts = 21, dts = 22
pts = 24, dts = 23
pts = 23, dts = 24
pts = 26, dts = 25
pts = 25, dts = 26
pts = 28, dts = 27
pts = 27, dts = 28
pts = 30, dts = 29

We know PTS can be different from DTS when B frame is used. But according to documentation here https://msdn.microsoft.com/en-us/library/windows/desktop/dd797816(v=vs.85).aspx 

  • 0: Do not use B frames (default).

B frames by default are not used, so that DTS SHOULD be same with PTS.

Could anyone help to explain it? I'm looking for a way to get monotonically increasing PTSs.

Thanks


How to switch to the next presentation in a Media Session when using Live Sources in the topologies ?

$
0
0

Hi,

i never had any issues with queuing and playing normal topologies before but this one realy makes me struggle. I am on it for almost 3 complete days ( i know its just a trivial problem ... ) but no luck.

I am queuing Live Recording Topologies, kinda bit like the CPlayer example from the MSDN docs but as Recorder. I create a media session on application startup and shutdown/release it before the app quits. When the user is pressing a hotkey/button a recording starts or stops, which means a topology is either queued and played or shutdown and cleared.

The first topology plays fine, start and stop work as expected. But when i am queuing the next topology and try to start it, the media session still trys to play the first topology. In the Topology there are 3-4 live sources, 2 are custom implemented and 2 are device sources. Since live sources do not send an MEEndOfStream, there is never an MEEndOfPresentation and so the media session doesnt know when to switch to the next topology. The process for playing 2 or more topologys is this :

->

1. Create first topology and queue it

2. Start Media Session.

3. Stop Media Session

4. On MESessionStopped shutdown media sources, asynchronous MFTs and call BeginFinalize Sink

5. On the callback of the sink call EndFinalize and then clear the current topology

6. Queue next topology

7. Start media Session

<-

And here at 7 it fails with HRESULT of "Invalid Request because shutdown has been called" ( MF_E_SHUTDOWN ). This makes sense as i just shutdown all the sources, transforms and sinks in the first topology so it cannot be started again.

As the MSDN doc states "The media session might keep the topology even after clear was called". Well its exactly what happens. It doesnt matter if you call SetTopology with the MFSESSION_SETTOPOLOGY_CLEAR_CURRENT flag or ClearTopologies, the session always keeps the first topology. The problem with switching to the next presentation is that there is no MEEndOfStream from the presentation streams and thus no MEEndOfPresentation. So the session still sees the first topology as the current presentation. Create and shutdown down a media session for each recording works of course, but thats not a fine solution.

My question is simple. How to switch to the next presentation/topology in the media session when using live sources? I tryed sending MEEndOfPresentation but with no affect. And my sources cant send MEEndOfStream as they are not all custom written, some of them are Device Sources.

I know that is walls of text for such a trivial problem, but i tested almost everything and read thousands of sites in the past 3 days, and i am almost going crazy.

Please can somebody point me to it.

Regards

co0Kie


resize video

$
0
0

Hi,

could you tell me the best approach to resize a video (Win7 & Win8)? At the moment I am trying to use the video resizer DSP, but the video is not always resized correctly. Sometimes I get only some strange pixel-images. Sometimes it works. 

        hr = CoCreateInstance (CLSID_CResizerDMO, NULL, CLSCTX_ALL, __uuidof(IMFTransform), (void**)(&rescaler));
        IPropertyStore* thePropertyStore;
        hr = rescaler->QueryInterface (&thePropertyStore);

        PROPVARIANT theWidthVariant, theHeightVariant;
        InitPropVariantFromInt32 (videoOutputWidth, &theWidthVariant);
        InitPropVariantFromInt32 (videoOutputHeight, &theHeightVariant);
        thePropertyStore->SetValue (MFPKEY_RESIZE_MINAPWIDTH, theWidthVariant);
        thePropertyStore->SetValue (MFPKEY_RESIZE_MINAPHEIGHT, theHeightVariant);

        PROPVARIANT theXVariant, theYVariant;
        InitPropVariantFromInt32 (0, &theXVariant);
        InitPropVariantFromInt32 (0, &theYVariant);
        thePropertyStore->SetValue (MFPKEY_RESIZE_MINAPX, theXVariant);
        thePropertyStore->SetValue (MFPKEY_RESIZE_MINAPY, theYVariant);

Which additional properties do I have to set? "videoOutputWidth" and "videoOutputHeight" should be the size of the resized video. Depending on the used properties, ProcessOutput returns E_FAIL (for example, if I try to set MFPKEY_RESIZE_DST_WIDTH with videoOutputWidth.

        IMFMediaType* inputType;
        IMFMediaType* outputType;

        hr = decoder->GetOutputCurrentType (0, &inputType);   //from the decoder IMFTransform
        MFCreateMediaType (&outputType);

        inputType->CopyAllItems (outputType)

        MFSetAttributeSize (outputType, MF_MT_FRAME_SIZE, videoOutputWidth, videoOutputHeight);

        hr = rescaler->SetInputType (0, inputType, 0);
        hr = rescaler->SetOutputType (0, outputType, 0);
        hr = rescaler->ProcessInput (0, sample, 0);

        hr = rescaler->ProcessOutput(0, 1, &outputbuffer, &status);

best regards

saoirse

IMFSample audio sample count

$
0
0

Hi,

a IMFSample represents a container for video or audio media data. For video, a sample typically contains one video frame. For audio data, a sample typically contains multiple audio samples, rather than a single sample of audio.

How can I get the information about the correct sample count in an IMFSample?

best regards

saoirse

MFPutWorkItem requires main thread?

$
0
0

I've been getting an exception in my Windows 7 64-bit C++ application, when calling MFPutWorkItem() on a secondary thread. My IMFAsyncCallback::GetParameters() implementation gets called, but not my IMFAsyncCallback::Invoke() implementation. In my call stack I see_beginthreadex() at the top, CWorkQueue::CThread::Init() next down, and CWorkQueue::AddThread() next down again. My call to MFPutWorkItem() targets MFASYNC_CALLBACK_QUEUE_MULTITHREADED.

When I call MFPutWorkItem() on the main/UI thread, it works fine. Is there a requirement for MFPutWorkItem() to be called on the main thread?

To explain why I'm trying to use a secondary thread for the call:

my application is using OpenGL to animate some geometry in my CWnd-based window,

my OnPaint() message handler calls SwapBuffers() to display the current frame, copies the pixel data associated with the CWnd's area on the screen into a CImage, and releases a secondary thread to convert the CImage's pixel data from its RGB colour space into the YUV colour space for the 'H264 Encoder MFT'-configured IMFTransform, using an OpenGL shader program.

When the shader program has finished, I was trying to copy the formatted YUV pixel data into an IMFBuffer, add that buffer to an IMFSample, and call MFPutWorkItem(). My Invoke() implementation calls IMFTransform::ProcessInput() on the IMFSample, to perform the H264 video encoding.

I don't pretend to know much about Media Foundation, and there may well be much better ways of saving my animation into an AVI.

My problem at this stage though is that MFPutWorkItem() doesn't seem to be happy being called on secondary thread. Is that behaviour expected, or is there something I'm not doing correctly?

cannot add wmp control to visual studio toolbox

$
0
0

 First of all apologies, I have indeed read the before posting thread, but the link to Windows Media Player sdk is broken "we  are   sorry, the page you requested cannot be found".

I am trying to use the windows media player control in visual studio 2015 community. However the control does not get add it to the toolbox.

I have followed the steps as per Microsoft documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/dd564585(v=vs.85).aspx

1.Right-click within the Toolbox, and then select Choose Items. This opens the Customize Toolbox dialog box.

2.On the COM Components tab, select Windows Media Player.

And then I get this message:


Visual studio de following controls were successfully added to the toolbox but are not enabled in the active designer

Windows Media Player

Make sure the controls to add are compatible with the current designer and .NET framework version


This is a new development machine with Windows 10. The project is targeting .NET 4.0

 Thanks

Media Foundation Streaming to callback?

$
0
0

Hi,

I would like to stream media file to server or to callback function in the same file or other file somewhere that delivers Byte format? The question is straightforward. I don't want to display Media content to Screen.

I am not sure if using the Source Reader would help!. I am able to do this with Windows Store App but I would like it to support Windows 7 +. That is the problem and I can't use new APIs that only existing on Windows 8.X.

Calback:

Callback_NewFrame(BYTE*data, int FrameWidth, int FrameHeight)

Any suggestion welcome.

Or Could I accomplish with MediaSource?

Thanks,

Weera


Media Foundation Streaming?

$
0
0

Hi,

I would like to stream media file to server or to callback function in the same file or other file somewhere that delivers Byte format? The question is straightforward. I don't want to display Media content to Screen.

I am not sure if using the Source Reader would help!. I am able to do this with Windows Store App but I would like it to support Windows 7 +. That is the problem and I can't use new APIs that only existing on Windows 8.X.

Any suggestion welcome.

Or Could I accomplish with MediaSource?

Thanks,

Weera






CLSID_CResizerDMO resize video frames

$
0
0

Hi,

I`ve a video frame with the size 1280 x 720 and I want to resize this frame to 55 x 31. Unfortunately using the video resizer dsp (CLSID_CResizerDMO) it is not always working.

When I set the output type (SetOutputType) I get the return error E_INVALIDARG. Resizing the video is not working as expected, the video frame has the size 1280 x 31 instead of 55 x 31.

When I set the frame size to 60 x 34, I can set the output type (SetOutputType) and I can also resize the video frame as expected.

Could you tell me why the first resize test is not working as expected? Are there some problems with odd video width sizes?

best regards

saoirse

How to get bitrate statistics from a H.264 Encoder to do a "Post Encoding Update" on the Stream Sinks of an ASF File Sink

$
0
0

Hi,

i need to update the Average ( Actual ) Bitrate afte encoding is done. ThePostEncodingUpdate method in the "1-Pass Windows Media Encoding" tutorial works with Windows Media Codecs, but for H.264 most stats are missing. So how to do the update correctly when storing H.264 content in an ASF file ?

For MP4 file authoring there is no problem, as the MPEG4 Sink does update all the values itself on finalizing. It seems that for the ASF File Sink we have to do it manually like in the above meantioned tutorial. The example there only covers Windows Media Codecs though. I tryed to do some mapping between MFPKEY and CODECAPI properties, but most values are missing.

It doesnt matter if i use CBR or VBR modes on the H.264 encoder, the bitrate i see in the file is the one i set on the media type. Does the Windows Media Codecs need more accurate informations to be set in the ASF file in order to work correct with Streaming and Decoding ? Maybe its unnecessary for other Codecs ? I mean the encoded files play fine, but i am wondering why the MP4 file shows bitrates like 4659 KBits/s or so, while the ASF file always shows the 5000 KBit/s i set on the media type.

Regards

co0Kie




keyframe spacing / video GOP information

$
0
0

Hi,

how can I get the information if all video samples are independent (using the SourceReader API)? I tried MF_MT_ALL_SAMPLES_INDEPENDENT; but the return value is always that this attribute was not found. Using the MF_MT_MAX_KEYFRAME_SPACING attribute, I get the same behaviour.

          

PROPVARIANT var;
 hr = sourceReader->GetPresentationAttribute (MF_SOURCE_READER_FIRST_VIDEO_STREAM, MF_MT_VIDEO_CHROMA_SITING, &var);

LONGLONG chroma;
hr = PropVariantToInt64 (var, &chroma);
PropVariantClear (&var);

hr = sourceReader->GetPresentationAttribute (MF_SOURCE_READER_FIRST_VIDEO_STREAM, MF_MT_MAX_KEYFRAME_SPACING, &var);           

hr = sourceReader->GetPresentationAttribute (MF_SOURCE_READER_FIRST_VIDEO_STREAM, MF_MT_ALL_SAMPLES_INDEPENDENT, &var);

best regards

saoirse



where do I get the IID_IDirect3DDeviceManager9 interface?

$
0
0

Hi,

could you tell me the steps to get the IDirect3DDeviceManager9 interface to setup the video decoder using DXVA?

I use the MFTEnumEx method to get the video decoder transform interface (IMFTransform) for H.264 videos.  After that I try to get the attributes from this IMFTransform interface and check the MF_SA_D3D_AWARE setting.

IMFAttributes* pAttributes = NULL;
hr = decoder->GetAttributes (&pAttributes);
if (MFGetAttributeUINT32 (pAttributes, MF_SA_D3D_AWARE, false))
   hr = pAttributes->SetUINT32 (CODECAPI_AVDecVideoAcceleration_H264, TRUE);


As a further step, I think I need the IID_IDirect3DDeviceManager9 interface. Is this correct and where do I get the IID_IDirect3DDeviceManager9 interface? In other examples, it seems to me that the ProcessMessage call will setup such an interface. But I have not subclassed the IMFTransform interface. Is this necessary to establish a DXVA decoder?  

IDirect3DDeviceManager9* manager = nullptr;

HRESULT hr = decoder->ProcessMessage (MFT_MESSAGE_SET_D3D_MANAGER,
        reinterpret_cast<ULONG_PTR>(manager));

hr = decoder->QueryInterface (IID_IDirect3DDeviceManager9, (void **)&manager);

The last call fails with the return code, that no such interface is supported.

best regards

saoirse


How do I create a IMFMediaSource from a PCM stream.

$
0
0

Hi,

I have configured a MediaSession with a custom topology and have gotten it to work for outputting sound files.  Now I want to take a stream from ISpVoice (SAPI) and run the stream through the same topology I have already created.  I am not sure how to create a IMFMediaSource from a IStream when the IStream is just a plain PCM format.

Here is the code I have so far. (I have removed error checking and release calls to shorten the example.)

ISpVoice* pVoice;   //SAPI voice

HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);

ISpStreamFormat* voiceStream;

hr = pVoice->GetOutputStream(&voiceStream);

IMFByteStream* byteStream;

hr = MFCreateMFByteStreamOnStream(voiceStream, &byteStream);

IMFSourceResolver* pSourceResolver;

IUnknown* pSource;

hr = MFCreateSourceResolver(&pSourceResolver);

// I think this is where the problem is.  How do I tell the source resolver that 

// it is a raw PCM stream.  

// this next call returns MF_E_UNSUPPORTED_BYTESTREAM_TYPE currently.

hr = pSourceResolver->CreateObjectFromByteStream(
            p_stream, 
            NULL, // URL
            MF_RESOLUTION_MEDIASOURCE, // Create a source object.
            NULL, // Optional property store.
            &ObjectType,        // Receives the created object type. 
            &pSource            // Receives a pointer to the media source.
            );

IMFMediaSource **ppSource;

hr = pSource->QueryInterface(IID_PPV_ARGS(ppSource));

So what am I doing wrong?  Is there a better way to approach this problem?

Thanks for your help,

Jeff


How to Access AVStream Extended Camera Control Properties via Media Foundation

$
0
0

I'm looking for the API in Media foundation to access the extended camera controls KSPROPERTYSETID_ExtendedCameraControl

For example: 

KSPROPERTY_CAMERACONTROL_EXTENDED_PHOTOMODE, KSPROPERTY_CAMERACONTROL_EXTENDED_EVCOMPENSATION

Is there anything similar to the standard interfaces IAMCameraControl , IAMVideoProcAmp if not what is the standard way to access - set or query these controls?

Code for MFManagedEncode

$
0
0

Where can I find the code to MFManagedEncode?  Thanks.


Custom D3D11-based EVR presenter/mixer

$
0
0

The EVR supports custom presenter and mixer implementations. The documentation about implementing IMFVideoDeviceID in a custom presenter states: "If you replace both components [mixer and presenter], you could define a new device GUID." In accordance with the documentation about D3D11-based decoder MFTs I return IID_ID3D11Device for both.

Now when plugging in both custom implementations the EVR media sink fails to activate. The presenter is queried only for an IDirect3DDeviceManager9 instance (not IMFDXGIDeviceManager). Then later, when the topology loader connects the nodes, before setting the input type on the mixer, it tries to use this device manager to get an IDirectXVideoAccelerationService instance.

Are there any knobs I can turn to get the desired behavior without having to replace the whole EVR media sink?

Handling of ID3 tags using the Media Foundation API and MP3 (using C++)

$
0
0

I am working on an existing utility that can take an audio file, such as uncompressed audio, and encode it to a different format, such as AAC or MP3. In my case, I am actually doing both AAC and MP3. The media foundation API has made it much simpler than I envisioned it would be, which is great. But I am not having much luck in finding information relating to the writing of metadata, such as title and artist, in the ACC and MP3 file.

Ideally, I would like to write the ID3 tag followed by writing of the MP3 data. I was having some trouble with IMFMetadata so I started to look at ID3Lib. This little library is great but when I am encoding the file to MP3, the encoding process is writing the MP3 data over the top of the ID3 tag data. I cannot find any means to set a file position with the Media Foundation API or a way to tell it to skip the ID3 tag, if present.

I am hoping someone can help point me down the right path.

Any ideas?


Al Pennyworth

How can I manually create H264 IMFSamples to feed a XAML Media Element in Windows 10

$
0
0

My goal is to be able to play an H264 bitstream from a network source in a XAML media element. I can get the H264 samples from the bitstream but so far the only way I have ever been able to display them is using libx264 to decode them to a bitmap and display that in a XAML image element.

I've gone through the Media Foundation samples on github, specifically the SimpleCommunication, and also the MediaStreamSource sample. Using those I have been able to: 

  • Play an mp4 file with output to the XAML MediaElement,
  • Generate custom bitmap IMFSamples and output to the XAML MediaElement (same approach as the SampleGenerator class in the MediaStreamSource sample).

What I haven't been able to do is a combination of the two steps above, get arbitrary H264 samples to display in the XAML MediaElement. What type of approach should I take for this? Do I need to write a custom IMFMediaSource or IMFByteStream that manually wires up an H264 decoder?

The fact that the Windows.Media.MediaProperties.VideoEncodingProperties now has the CreateH264 method does seem to indicate that the H264 decoding stage is already wired into the framework... but how can it be used with a network source rather than a static file source?

Here is a snippet of my code for playing an mp4 file. What I'm hoping is to find the equivalent for presenting a network source such as an RTSP stream.

C++/CX class that interfaces with the Media Foundation:

namespace SurfaceGenerator
{
	Mp4Sampler::Mp4Sampler()
	{ }

	void Mp4Sampler::Initialise(Platform::String^ path)
	{
		HRESULT hr = S_OK;
		IMFSourceResolver *pSourceResolver = nullptr;
		MF_OBJECT_TYPE objectType = MF_OBJECT_INVALID;
		IUnknown* uSource = nullptr;
		IMFMediaSource *mediaFileSource = nullptr;

		CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
		MFStartup(MF_VERSION);

		CHECK_HR(hr = MFCreateSourceResolver(&pSourceResolver), "MFCreateSourceResolver failed.\n");

		CHECK_HR(hr = pSourceResolver->CreateObjectFromURL(
			path->Begin(),
			MF_RESOLUTION_MEDIASOURCE,  // Create a source object.
			NULL,                       // Optional property store.&objectType,				// Receives the created object type.&uSource					// Receives a pointer to the media source.
			), "Failed to create media source resolver for file.\n");

		CHECK_HR(uSource->QueryInterface(IID_PPV_ARGS(&mediaFileSource)), "Failed to create media file source.\n");
		CHECK_HR(MFCreateSourceReaderFromMediaSource(mediaFileSource, NULL, &_videoReader),	"Error creating media source reader.\n");
		return;

	done:
		throw Platform::Exception::CreateException(hr, "Mp4Sample Initialise failed.");
	}

	void Mp4Sampler::GetSample(Windows::Media::Core::MediaStreamSourceSampleRequest ^ request)
	{
		Microsoft::WRL::ComPtr<IMFMediaStreamSourceSampleRequest> spRequest;
		HRESULT hr = S_OK;
		IMFSample *videoSample = NULL;
		DWORD streamIndex, flags;
		LONGLONG llTimeStamp;

		CHECK_HR(hr = reinterpret_cast<IInspectable*>(request)->QueryInterface(spRequest.ReleaseAndGetAddressOf()), "Failed to get MF interface for media sample request.\n");

		while (true)
		{
			CHECK_HR(hr = _videoReader->ReadSample(
				MF_SOURCE_READER_FIRST_VIDEO_STREAM,
				0,                              // Flags.&streamIndex,                   // Receives the actual stream index.&flags,                         // Receives status flags.&llTimeStamp,					// Receives the time stamp.&videoSample                    // Receives the sample or NULL.
				), "Error reading video sample.");

			if (flags & MF_SOURCE_READERF_ENDOFSTREAM)
			{
				OutputDebugStringW(L"End of stream.\n");
				return;
			}

			if (videoSample)
			{
				OutputDebugStringW(L"Attempting to write sample to stream sink.\n");
				CHECK_HR(hr = videoSample->SetSampleTime(llTimeStamp), "Error setting the video sample time.\n");
				CHECK_HR(hr = spRequest->SetSample(videoSample), "Error setting sample on media sample request.\n");
				return;
			}
		}

		done:

			throw Platform::Exception::CreateException(hr, "Mp4Sample GetSample failed.");
	}
}

Relevant methods from the C# WPF class that displays the video:

<MediaElement x:Name="_remoteVideo" Margin="0" RealTimePlayback="True" MinWidth="640" MinHeight="360"/>
        public void InitialiseMp4FileMedia(string path)
        {
            try
            {
                VideoEncodingProperties videoProperties = VideoEncodingProperties.CreateH264();
                _videoDesc = new VideoStreamDescriptor(videoProperties);
                _videoDesc.EncodingProperties.FrameRate.Numerator = FRAME_RATE;
                _videoDesc.EncodingProperties.FrameRate.Denominator = 1;
                //_videoDesc.EncodingProperties.Bitrate = (uint)(1 * FRAME_RATE * MP4_WIDTH * MP4_HEIGHT * 4);

                _mss = new Windows.Media.Core.MediaStreamSource(_videoDesc);
                TimeSpan spanBuffer = new TimeSpan(0);
                _mss.BufferTime = spanBuffer;
                _mss.Starting += mss_Starting;
                _mss.SampleRequested += mss_SampleRequested;

                _mp4Sampler = new SurfaceGenerator.Mp4Sampler();
                _mp4Sampler.Initialise(path);

                _remoteVideo.MediaFailed += _remoteVideo_MediaFailed;
                _remoteVideo.SetMediaStreamSource(_mss);
                _remoteVideo.Play();
            }
            catch(Exception excp)
            {
                Debug.WriteLine("Exception InitialiseMp4FileMedia. " + excp);
            }
        }

        void mss_SampleRequested(Windows.Media.Core.MediaStreamSource sender, MediaStreamSourceSampleRequestedEventArgs args)
        {
            if (args.Request.StreamDescriptor is VideoStreamDescriptor)
            {
                _mp4Base64Sampler.GetSample(args.Request);
            }
        }



How to switch to the next presentation in a Media Session when using Live Sources in the topologies ?

$
0
0

Hi,

i never had any issues with queuing and playing normal topologies before but this one realy makes me struggle. I am on it for almost 3 complete days ( i know its just a trivial problem ... ) but no luck.

I am queuing Live Recording Topologies, kinda bit like the CPlayer example from the MSDN docs but as Recorder. I create a media session on application startup and shutdown/release it before the app quits. When the user is pressing a hotkey/button a recording starts or stops, which means a topology is either queued and played or shutdown and cleared.

The first topology plays fine, start and stop work as expected. But when i am queuing the next topology and try to start it, the media session still trys to play the first topology. In the Topology there are 3-4 live sources, 2 are custom implemented and 2 are device sources. Since live sources do not send an MEEndOfStream, there is never an MEEndOfPresentation and so the media session doesnt know when to switch to the next topology. The process for playing 2 or more topologys is this :

->

1. Create first topology and queue it

2. Start Media Session.

3. Stop Media Session

4. On MESessionStopped shutdown media sources, asynchronous MFTs and call BeginFinalize Sink

5. On the callback of the sink call EndFinalize and then clear the current topology

6. Queue next topology

7. Start media Session

<-

And here at 7 it fails with HRESULT of "Invalid Request because shutdown has been called" ( MF_E_SHUTDOWN ). This makes sense as i just shutdown all the sources, transforms and sinks in the first topology so it cannot be started again.

As the MSDN doc states "The media session might keep the topology even after clear was called". Well its exactly what happens. It doesnt matter if you call SetTopology with the MFSESSION_SETTOPOLOGY_CLEAR_CURRENT flag or ClearTopologies, the session always keeps the first topology. The problem with switching to the next presentation is that there is no MEEndOfStream from the presentation streams and thus no MEEndOfPresentation. So the session still sees the first topology as the current presentation. Create and shutdown down a media session for each recording works of course, but thats not a fine solution.

My question is simple. How to switch to the next presentation/topology in the media session when using live sources? I tryed sending MEEndOfPresentation but with no effect. And my sources cant send MEEndOfStream as they are not all custom written, some of them are Device Sources.

I know that is walls of text for such a trivial problem, but i tested almost everything and read thousands of sites in the past 3 days, and i am almost going crazy.

Please can somebody point me to it.

Regards

co0Kie



How to resize a Video Stream during encoding in a Media Session ? Is there any Tutorial/Sample about Resizing using the Video Processor MFT ?

$
0
0

Hi

I had to delete my other Question as it turned out i can test Resizing in the same Project by just modifying the D3D Rendering. The Problem is still the same :

I do some Encoding in a Media Session and one of my Custom Live Video Sources ( Proxy to a Direct3D Device ) is changing Resolution from time to time. When the Resolution is changing i first create the new Media Type and set it on the Presentation Descriptor, and then i queue MEStreamFormatChanged on the Stream. It works when lowering the Resolution, but fails when setting it higher. In the Media Session i get a HRESULT of "Wrong Parameter".

I normaly dont use MFTrace as my own Logfile/PrintToDebug system often works better, but for this case i gave it another try. I ran MFTrace 2 times, but the Logs reveal nothing to me. They almost look identical. In the first run i lowered the Resolution, and in the second i set it higher. Since my App offers some checkmarks for other Sources/Branches ( like Audio for example ) anyway, i deactivated all but one, to keep the log smaller. Here are the logs :

LOWERED THE RESOLUTION :

4412,12E4 17:03:00.40824 CMFMediaStreamDetours::EndGetEvent @05DD5540 Met=216 MEStreamFormatChanged, value @037A9458,
4412,12E4 17:03:00.40831 CMFMediaStreamDetours::HandleEvent @05DD5540 New format MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=4294962176;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=3686400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
4412,12E4 17:03:00.40840 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = {3C5D293F-AD67-4E29-AF12-CF3E238ACCE9}
4412,12E4 17:03:00.40842 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = {9C27891A-ED7A-40E1-88E8-B22727A024EE}
4412,12E4 17:03:00.40843 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = {4A0A1E1F-272C-4FB6-9EB1-DB330CBC97CA}
4412,12E4 17:03:00.40852 CMFTransformDetours::SetInputType @0379BF28 Succeeded MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=4294962176;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=3686400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
4412,12E4 17:03:00.40855 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE
4412,12E4 17:03:00.40856 CMFTransformDetours::ProcessMessage @0379BF28 Message type=0x00000001 MFT_MESSAGE_COMMAND_DRAIN, param=00000000
4412,12E4 17:03:00.40857 CMFTransformDetours::ProcessOutput @0379BF28 failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
4412,12E4 17:03:00.40860 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = {3C5D293F-AD67-4E29-AF12-CF3E238ACCE9}
4412,12E4 17:03:00.40862 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = {9C27891A-ED7A-40E1-88E8-B22727A024EE}
4412,12E4 17:03:00.40863 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = {4A0A1E1F-272C-4FB6-9EB1-DB330CBC97CA}
4412,12E4 17:03:00.40943 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = {3C5D293F-AD67-4E29-AF12-CF3E238ACCE9}
4412,12E4 17:03:00.40950 CMFTransformDetours::SetInputType @0379BF28 Succeeded MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=4294962176;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=3686400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
4412,12E4 17:03:00.40951 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE
4412,12E4 17:03:00.40956 CMFTransformDetours::SetInputType @07461AE8 Failed MT: MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_SUBTYPE=MFVideoFormat_RGB32
4412,12E4 17:03:00.40958 CMFTransformDetours::SetInputType @07461AE8 Failed MT: MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
4412,12E4 17:03:00.40961 CMFTransformDetours::SetInputType @07461AE8 Succeeded MT: MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_SUBTYPE=MFVideoFormat_NV12
4412,12E4 17:03:00.40964 CMFTransformDetours::SetOutputType @0379BF28 Failed MT: MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_SUBTYPE=MFVideoFormat_NV12
4412,12E4 17:03:00.40965 CMFTopologyDetours::GetUINT32 @037AA6B0 attribute not found guidKey = MF_TOPOLOGY_DYNAMIC_CHANGE_NOT_ALLOWED
4412,12E4 17:03:00.40968 CMFTopologyNodeDetours::GetUINT32 @037AAB18 attribute not found guidKey = MF_TOPONODE_LOCKED
4412,12E4 17:03:00.40971 CMFTopologyNodeDetours::GetUnknown @037AAB18 attribute not found guidKey = {B8AA3129-DFC9-423A-8ACD-1D82850A3D1F}
4412,12E4 17:03:00.40974 CMFTopologyNodeDetours::GetUnknown @037AAB18 attribute not found guidKey = {B8AA3129-DFC9-423A-8ACD-1D82850A3D1F}
4412,12E4 17:03:00.40975 CMFTopologyDetours::GetUINT32 @037AA6B0 attribute not found guidKey = {BFE3335C-490E-47D1-AB70-4F2416F467BA}
4412,12E4 17:03:00.40976 CMFTopologyNodeDetours::GetUINT32 @037AAE00 attribute not found guidKey = MF_TOPONODE_D3DAWARE
4412,12E4 17:03:00.40978 CMFTopologyDetours::GetUINT32 @037AA6B0 attribute not found guidKey = {BFE3335C-490E-47D1-AB70-4F2416F467BA}
4412,12E4 17:03:00.40980 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = MF_TRANSFORM_ASYNC
4412,12E4 17:03:00.40982 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = MF_TRANSFORM_ASYNC
4412,12E4 17:03:00.40984 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = MF_TRANSFORM_ASYNC
4412,12E4 17:03:00.40985 CMFAttributesDetours::GetStringLength @0071BCD8 attribute not found guidKey = MFT_ENUM_HARDWARE_URL_Attribute
4412,12E4 17:03:00.40989 CMFAttributesDetours::GetUINT32 @0071BCD8 attribute not found guidKey = MF_TRANSFORM_ASYNC
4412,12E4 17:03:00.40990 CMFTopologyNodeDetours::GetUINT32 @037AAE00 attribute not found guidKey = MF_TOPONODE_LOCKED
4412,12E4 17:03:00.40999 CMFTransformDetours::SetOutputType @0379BF28 Succeeded MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=1920;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=3110400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_NV12
4412,12E4 17:03:00.41000 CMFTopologyNodeDetours::GetUINT32 @037AAB18 attribute not found guidKey = MF_TOPONODE_DECRYPTOR
4412,12E4 17:03:00.41005 CMFTopologyNodeDetours::GetUINT32 @037AAB90 attribute not found guidKey = {6D7E1A30-106C-43B9-ACCE-ADBA943F42EC}
4412,12E4 17:03:00.41006 CMFTopologyNodeDetours::GetUINT32 @037AAD88 attribute not found guidKey = {6D7E1A30-106C-43B9-ACCE-ADBA943F42EC}
4412,12E4 17:03:00.41008 CMFTopologyNodeDetours::GetUINT32 @037AAB18 attribute not found guidKey = {6D7E1A30-106C-43B9-ACCE-ADBA943F42EC}
4412,168 17:03:00.41015 CMFMediaSessionDetours::EndGetEvent @037AB408 Met=111 MESessionTopologyStatus, value @037AA6B0, MF_EVENT_TOPOLOGY_STATUS=210
4412,168 17:03:00.41016 CTopologyHelpers::Trace @037AA6B0 >>>>>>>>>>>>> changed topology
4412,12E4 17:03:00.41017 CMFTransformDetours::SetInputType @07461AE8 Succeeded MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=1920;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=3110400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_NV12
4412,12E4 17:03:00.41020 CMFTransformDetours::HandleEvent @07461AE8 Met=602 (null), value (empty),
4412,12E4 17:03:00.41021 CMFTransformDetours::HandleEvent @07461AE8 1 ProcessOutputs available
4412,12E4 17:03:00.41022 CMFTransformDetours::ProcessOutput @07461AE8 0 ProcessOutputs available
4412,168 17:03:00.41024 CTopologyHelpers::TraceNode @ Node 0 @037AAD88 ID:113C00000001, 0 inputs, 1 outputs, type 1, MF_TOPONODE_CONNECT_METHOD=1;MF_TOPONODE_MARKIN_HERE=1;MF_TOPONODE_MARKOUT_HERE=1;MF_TOPONODE_MEDIASTART=0 (0,0);MF_TOPONODE_SOURCE=@05E11DD4;MF_TOPONODE_PRESENTATION_DESCRIPTOR=@0379BBB8;MF_TOPONODE_STREAM_DESCRIPTOR=@037937F8;{89485B85-2FFA-4547-B269-B82C79EE197C}=1;{9C86CC4E-68CE-4CFF-AA1E-9A5A40D5B4E0}=@037AD338;{9C86CC52-68CE-4CFF-AA1E-9A5A40D5B4E0}=0 (0,0)
4412,168 17:03:00.41025 CMFTopologyNodeDetours::GetGUID @037AAD88 attribute not found guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
4412,12E4 17:03:00.41027 CMFTransformDetours::ProcessOutput @07461AE8 Stream ID 0, Sample @037AE2E0, Time 2616ms, Duration 16ms, Buffers 1, Size 76B, MFSampleExtension_Token=@00000000;{9154733F-E1BD-41BF-81D3-FCD918F71332}=65535;MFSampleExtension_Interlaced=0
4412,168 17:03:00.41027 CTopologyHelpers::TraceObject @ Source @05E11DD4 {00000000-0000-0000-0000-000000000000} (c:\Users\Franz\Documents\Visual Studio 2013\Projects\CIF\Debug\CIF.exe), MFMEDIASOURCE_CHARACTERISTICS=0x00000001
4412,168 17:03:00.41032 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @037AAE00 stream 0, MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=4294962176;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=3686400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
4412,12E4 17:03:00.41034 CMFStreamSinkDetours::ProcessSample @0379B128 Sample @037AE2E0, Time 2616ms, Duration 16ms, Buffers 1, Size 76B, MFSampleExtension_Token=@037B6B40;{9154733F-E1BD-41BF-81D3-FCD918F71332}=65535;MFSampleExtension_Interlaced=0
4412,168 17:03:00.41035 CTopologyHelpers::TraceNode @ Node 1 @037AAE00 ID:113C00000002, 1 inputs, 1 outputs, type 2, MF_TOPONODE_CONNECT_METHOD=5;{89485B85-2FFA-4547-B269-B82C79EE197C}=1;{9C86CC4E-68CE-4CFF-AA1E-9A5A40D5B4E0}=@037AD570
4412,168 17:03:00.41036 CMFTopologyNodeDetours::GetGUID @037AAE00 attribute not found guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
4412,12E4 17:03:00.41040 CMFStreamSinkDetours::EndGetEvent @0379B128 Met=305 (null), value (empty),
4412,168 17:03:00.41040 CTopologyHelpers::TraceObject @ MFT @0379BF28 {00000000-0000-0000-0000-000000000000} (C:\WINDOWS\System32\msvproc.dll), {093F81B1-4F2E-4631-8168-7934032A01D3}=1;{206B4FC8-FCF9-4C51-AFE3-9764369E33A0}=1;{851745D5-C3D6-476D-9527-498EF2D10D18}=4
4412,168 17:03:00.41046 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @037AAD88 stream 0, MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=4294962176;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=3686400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
4412,168 17:03:00.41051 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @037AAB18 stream 0, MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=1920;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=3110400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_NV12
4412,168 17:03:00.41054 CTopologyHelpers::TraceNode @ Node 2 @037AAB18 ID:113C00000003, 1 inputs, 1 outputs, type 2, MF_TOPONODE_LOCKED=0;{89485B85-2FFA-4547-B269-B82C79EE197C}=1;{9C86CC4E-68CE-4CFF-AA1E-9A5A40D5B4E0}=@0379F9E8
4412,168 17:03:00.41055 CMFTopologyNodeDetours::GetGUID @037AAB18 attribute not found guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
4412,168 17:03:00.41062 CTopologyHelpers::TraceObject @ MFT @07461AE8 {00000000-0000-0000-0000-000000000000} (C:\Program Files\Common Files\ATI Technologies\Multimedia\AMDh264Enc32.dll), {206B4FC8-FCF9-4C51-AFE3-9764369E33A0}=1;MFT_ENUM_HARDWARE_URL_Attribute=AMDh264Encoder;{3AECB0CC-035B-4BCC-8185-2B8D551EF3AF}=AMD;MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE=1;{E3F2E203-D445-4B8C-9211-AE390D3BA017}=634299;MF_TRANSFORM_ASYNC_UNLOCK=1;MF_SA_D3D_AWARE=1;{F34B9093-05E0-4B16-993D-3E2A2CDE6AD3}=3942805747531776 (918006,0);MF_TRANSFORM_ASYNC=1
4412,168 17:03:00.41067 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @037AAE00 stream 0, MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=1920;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=3110400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_NV12
4412,168 17:03:00.41085 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @037AAB90 stream 0, MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_AVG_BITRATE=50000000;MF_MT_MPEG_SEQUENCE_HEADER=00 00 00 01 67 64 00 29 ac 26 50 1e 00 89 f9 60 1b 41 10 8c b0 00 00 00 01 68 ee 38 80 ;{45256D30-7215-4576-9336-B0F1BCD59BB2}=bb ad 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_MPEG2_PROFILE=100;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MEDIASUBTYPE_H264
4412,168 17:03:00.41089 CTopologyHelpers::TraceNode @ Node 3 @037AAB90 ID:113C00000004, 1 inputs, 0 outputs, type 0, MF_TOPONODE_STREAMID=0;MF_TOPONODE_NOSHUTDOWN_ON_REMOVE=0;MF_TOPONODE_DISABLE_PREROLL=1;{89485B85-2FFA-4547-B269-B82C79EE197C}=1;{9C86CC4E-68CE-4CFF-AA1E-9A5A40D5B4E0}=@037ADC90
4412,168 17:03:00.41090 CMFTopologyNodeDetours::GetGUID @037AAB90 attribute notfound guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
4412,168 17:03:00.41091 CTopologyHelpers::TraceObject @ Sink @0379B128 {00000000-0000-0000-0000-000000000000} (C:\WINDOWS\System32\mfmp4srcsnk.dll), (null)
4412,168 17:03:00.41106 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @037AAB18 stream 0, MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_AVG_BITRATE=50000000;MF_MT_MPEG_SEQUENCE_HEADER=00 00 00 01 67 64 00 29 ac 26 50 1e 00 89 f9 60 1b 41 10 8c b0 00 00 00 01 68 ee 38 80 ;{45256D30-7215-4576-9336-B0F1BCD59BB2}=bb ad 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_MPEG2_PROFILE=100;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MEDIASUBTYPE_H264
4412,168 17:03:00.41107 CTopologyHelpers::Trace @037AA6B0 MF_TOPOLOGY_RESOLUTION_STATUS = 0
4412,168 17:03:00.41107 CTopologyHelpers::Trace @037AA6B0 <<<<<<<<<<<<< changed topology

SET THE RESOLUTION HIGHER :

3352,F20 15:54:24.08064 CMFMediaStreamDetours::EndGetEvent @05F5F9E0 Met=216 MEStreamFormatChanged, value @03A5AD58,
3352,F20 15:54:24.08071 CMFMediaStreamDetours::HandleEvent @05F5F9E0 New format MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=4294959616;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=8294400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
3352,F20 15:54:24.08080 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = {3C5D293F-AD67-4E29-AF12-CF3E238ACCE9}
3352,F20 15:54:24.08082 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = {9C27891A-ED7A-40E1-88E8-B22727A024EE}
3352,F20 15:54:24.08084 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = {4A0A1E1F-272C-4FB6-9EB1-DB330CBC97CA}
3352,F20 15:54:24.08094 CMFTransformDetours::SetInputType @03A59FD0 Succeeded MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=4294959616;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=8294400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
3352,F20 15:54:24.08097 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE
3352,F20 15:54:24.08098 CMFTransformDetours::ProcessMessage @03A59FD0 Message type=0x00000001 MFT_MESSAGE_COMMAND_DRAIN, param=00000000
3352,F20 15:54:24.08099 CMFTransformDetours::ProcessOutput @03A59FD0 failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
3352,F20 15:54:24.08102 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = {3C5D293F-AD67-4E29-AF12-CF3E238ACCE9}
3352,F20 15:54:24.08104 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = {9C27891A-ED7A-40E1-88E8-B22727A024EE}
3352,F20 15:54:24.08105 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = {4A0A1E1F-272C-4FB6-9EB1-DB330CBC97CA}
3352,F20 15:54:24.08187 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = {3C5D293F-AD67-4E29-AF12-CF3E238ACCE9}
3352,F20 15:54:24.08193 CMFTransformDetours::SetInputType @03A59FD0 Succeeded MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=4294959616;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=8294400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
3352,F20 15:54:24.08194 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE
3352,F20 15:54:24.08199 CMFTransformDetours::SetInputType @05FED838 Failed MT: MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_SUBTYPE=MFVideoFormat_RGB32
3352,F20 15:54:24.08201 CMFTransformDetours::SetInputType @05FED838 Failed MT: MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
3352,F20 15:54:24.08204 CMFTransformDetours::SetInputType @05FED838 Succeeded MT: MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_SUBTYPE=MFVideoFormat_NV12
3352,F20 15:54:24.08207 CMFTransformDetours::SetOutputType @03A59FD0 Failed MT:MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_SUBTYPE=MFVideoFormat_NV12
3352,F20 15:54:24.08208 CMFTopologyDetours::GetUINT32 @03A5DEF0 attribute not found guidKey = MF_TOPOLOGY_DYNAMIC_CHANGE_NOT_ALLOWED
3352,F20 15:54:24.08211 CMFTopologyNodeDetours::GetUINT32 @03A5E260 attribute not found guidKey = MF_TOPONODE_LOCKED
3352,F20 15:54:24.08212 CMFTopologyNodeDetours::GetUnknown @03A5E260 attribute not found guidKey = {B8AA3129-DFC9-423A-8ACD-1D82850A3D1F}
3352,F20 15:54:24.08214 CMFTopologyNodeDetours::GetUnknown @03A5E260 attribute not found guidKey = {B8AA3129-DFC9-423A-8ACD-1D82850A3D1F}
3352,F20 15:54:24.08215 CMFTopologyDetours::GetUINT32 @03A5DEF0 attribute not found guidKey = {BFE3335C-490E-47D1-AB70-4F2416F467BA}
3352,F20 15:54:24.08217 CMFTopologyNodeDetours::GetUINT32 @03A5E4D0 attribute not found guidKey = MF_TOPONODE_D3DAWARE
3352,F20 15:54:24.08218 CMFTopologyDetours::GetUINT32 @03A5DEF0 attribute not found guidKey = {BFE3335C-490E-47D1-AB70-4F2416F467BA}
3352,F20 15:54:24.08220 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = MF_TRANSFORM_ASYNC
3352,F20 15:54:24.08222 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = MF_TRANSFORM_ASYNC
3352,F20 15:54:24.08224 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = MF_TRANSFORM_ASYNC
3352,F20 15:54:24.08225 CMFAttributesDetours::GetStringLength @00C5BCD8 attribute not found guidKey = MFT_ENUM_HARDWARE_URL_Attribute
3352,F20 15:54:24.08228 CMFAttributesDetours::GetUINT32 @00C5BCD8 attribute not found guidKey = MF_TRANSFORM_ASYNC
3352,F20 15:54:24.08229 CMFTopologyNodeDetours::GetUINT32 @03A5E4D0 attribute not found guidKey = MF_TOPONODE_LOCKED
3352,F20 15:54:24.08238 CMFTransformDetours::SetOutputType @03A59FD0 Succeeded MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=1280;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=1382400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_NV12
3352,F20 15:54:24.08239 CMFTopologyNodeDetours::GetUINT32 @03A5E260 attribute not found guidKey = MF_TOPONODE_DECRYPTOR
3352,F20 15:54:24.08244 CMFTopologyNodeDetours::GetUINT32 @03A5E2D8 attribute not found guidKey = {6D7E1A30-106C-43B9-ACCE-ADBA943F42EC}
3352,F20 15:54:24.08246 CMFTopologyNodeDetours::GetUINT32 @03A5BA10 attribute not found guidKey = {6D7E1A30-106C-43B9-ACCE-ADBA943F42EC}
3352,F20 15:54:24.08247 CMFTopologyNodeDetours::GetUINT32 @03A5E260 attribute not found guidKey = {6D7E1A30-106C-43B9-ACCE-ADBA943F42EC}
3352,F20 15:54:24.08257 CMFTransformDetours::SetInputType @05FED838 Succeeded MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=1280;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=1382400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_NV12
3352,F20 15:54:24.08262 CMFMediaSessionDetours::EndGetEvent @03A5EAD8 Met=111 MESessionTopologyStatus, value @03A5DEF0, MF_EVENT_TOPOLOGY_STATUS=210
3352,F20 15:54:24.08263 CTopologyHelpers::Trace @03A5DEF0 >>>>>>>>>>>>> changed topology
3352,F20 15:54:24.08270 CTopologyHelpers::TraceNode @ Node 0 @03A5BA10 ID:D1800000001, 0 inputs, 1 outputs, type 1, MF_TOPONODE_CONNECT_METHOD=1;MF_TOPONODE_MARKIN_HERE=1;MF_TOPONODE_MARKOUT_HERE=1;MF_TOPONODE_MEDIASTART=0 (0,0);MF_TOPONODE_SOURCE=@05F4856C;MF_TOPONODE_PRESENTATION_DESCRIPTOR=@03A4CA18;MF_TOPONODE_STREAM_DESCRIPTOR=@03A4CE28;{89485B85-2FFA-4547-B269-B82C79EE197C}=1;{9C86CC4E-68CE-4CFF-AA1E-9A5A40D5B4E0}=@03A605F0;{9C86CC52-68CE-4CFF-AA1E-9A5A40D5B4E0}=0 (0,0)
3352,F20 15:54:24.08271 CMFTopologyNodeDetours::GetGUID @03A5BA10 attribute not found guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
3352,F20 15:54:24.08274 CTopologyHelpers::TraceObject @ Source @05F4856C {00000000-0000-0000-0000-000000000000} (c:\Users\Franz\Documents\Visual Studio 2013\Projects\CIF\Debug\CIF.exe), MFMEDIASOURCE_CHARACTERISTICS=0x00000001
3352,F20 15:54:24.08279 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @03A5E4D0 stream 0, MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=4294959616;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=8294400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
3352,F20 15:54:24.08282 CTopologyHelpers::TraceNode @ Node 1 @03A5E4D0 ID:D1800000002, 1 inputs, 1 outputs, type 2, MF_TOPONODE_CONNECT_METHOD=5;{89485B85-2FFA-4547-B269-B82C79EE197C}=1;{9C86CC4E-68CE-4CFF-AA1E-9A5A40D5B4E0}=@03A60828
3352,F20 15:54:24.08283 CMFTopologyNodeDetours::GetGUID @03A5E4D0 attribute not found guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
3352,F20 15:54:24.08287 CTopologyHelpers::TraceObject @ MFT @03A59FD0 {00000000-0000-0000-0000-000000000000} (C:\WINDOWS\System32\msvproc.dll), {093F81B1-4F2E-4631-8168-7934032A01D3}=1;{206B4FC8-FCF9-4C51-AFE3-9764369E33A0}=1;{851745D5-C3D6-476D-9527-498EF2D10D18}=4
3352,F20 15:54:24.08293 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @03A5BA10 stream 0, MT: MF_MT_FRAME_SIZE=8246337209400 (1920,1080);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=4294959616;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=8294400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_ARGB32
3352,F20 15:54:24.08299 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @03A5E260 stream 0, MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=1280;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=1382400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_NV12
3352,F20 15:54:24.08302 CTopologyHelpers::TraceNode @ Node 2 @03A5E260 ID:D1800000003, 1 inputs, 1 outputs, type 2, MF_TOPONODE_LOCKED=0;{89485B85-2FFA-4547-B269-B82C79EE197C}=1;{9C86CC4E-68CE-4CFF-AA1E-9A5A40D5B4E0}=@03A50A28
3352,F20 15:54:24.08303 CMFTopologyNodeDetours::GetGUID @03A5E260 attribute not found guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
3352,F20 15:54:24.08310 CTopologyHelpers::TraceObject @ MFT @05FED838 {00000000-0000-0000-0000-000000000000} (C:\Program Files\Common Files\ATI Technologies\Multimedia\AMDh264Enc32.dll), {206B4FC8-FCF9-4C51-AFE3-9764369E33A0}=1;MFT_ENUM_HARDWARE_URL_Attribute=AMDh264Encoder;{3AECB0CC-035B-4BCC-8185-2B8D551EF3AF}=AMD;MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE=1;{E3F2E203-D445-4B8C-9211-AE390D3BA017}=634299;MF_TRANSFORM_ASYNC_UNLOCK=1;MF_SA_D3D_AWARE=1;{F34B9093-05E0-4B16-993D-3E2A2CDE6AD3}=3942805747531776 (918006,0);MF_TRANSFORM_ASYNC=1
3352,F20 15:54:24.08315 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @03A5E4D0 stream 0, MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_DEFAULT_STRIDE=1280;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_SAMPLE_SIZE=1382400;MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MFVideoFormat_NV12
3352,F20 15:54:24.08330 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @03A5E2D8 stream 0, MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_AVG_BITRATE=50000000;MF_MT_MPEG_SEQUENCE_HEADER=00 00 00 01 67 64 00 29 ac 26 50 14 01 6e 80 6d 04 42 32 c0 00 00 00 01 68 ee 38 80 ;{45256D30-7215-4576-9336-B0F1BCD59BB2}=bb ad 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_MPEG2_PROFILE=100;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MEDIASUBTYPE_H264
3352,F20 15:54:24.08337 CTopologyHelpers::TraceNode @ Node 3 @03A5E2D8 ID:D1800000004, 1 inputs, 0 outputs, type 0, MF_TOPONODE_STREAMID=0;MF_TOPONODE_NOSHUTDOWN_ON_REMOVE=0;MF_TOPONODE_DISABLE_PREROLL=1;{89485B85-2FFA-4547-B269-B82C79EE197C}=1;{9C86CC4E-68CE-4CFF-AA1E-9A5A40D5B4E0}=@03A60F48
3352,F20 15:54:24.08338 CMFTopologyNodeDetours::GetGUID @03A5E2D8 attribute not found guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
3352,F20 15:54:24.08340 CTopologyHelpers::TraceObject @ Sink @03A4BF88 {00000000-0000-0000-0000-000000000000} (C:\WINDOWS\System32\mfmp4srcsnk.dll), (null)
3352,F20 15:54:24.08354 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @03A5E260 stream 0, MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_AVG_BITRATE=50000000;MF_MT_MPEG_SEQUENCE_HEADER=00 00 00 01 67 64 00 29 ac 26 50 14 01 6e 80 6d 04 42 32 c0 00 00 00 01 68 ee 38 80 ;{45256D30-7215-4576-9336-B0F1BCD59BB2}=bb ad 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_MPEG2_PROFILE=100;MF_MT_FRAME_RATE=257698037761 (60,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MEDIASUBTYPE_H264
3352,F20 15:54:24.08355 CTopologyHelpers::Trace @03A5DEF0 MF_TOPOLOGY_RESOLUTION_STATUS = 0
3352,F20 15:54:24.08356 CTopologyHelpers::Trace @03A5DEF0 <<<<<<<<<<<<< changed topology

As said, lowering the Resolution works perfectly. The Media Session does all the necessary changes for me. But setting the Resolution higher results in a HRESULT "Wrong Parameter" in the Media Session Events.

It seems that there is no Tutorial/Sample out there about resizing on the Video Processor MFT. I found 2 questions on Stackoverflow that stayed unanswered, but thats about it. Do we have to use the IMFVideoProcessorControl manually or is the Media Session doing the necessary changes ? Why is setting the Resolution higher failing ?

Regards

co0Kie




Viewing all 1079 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>