locked
How to configure the H.624 Encoder in IMFTSinkWriter in win8 app store?

    Question

  • Dear All:

    I'm using SinkWriter to create a Mp4 file but when i set the MF_MT_FRAME_RATEand MF_MT_AVG_BITRATE  to try to make the result smaller,  sometimes IMFTSinkWriter::Finalize  will not return.  So I try to set  MF_SINK_WRITER_ENCODER_CONFIGURE but  PSCreateMemoryPropertyStore API can only support desktop mode. SO in win8 app store how to configure it? 

    Thanks.

    Friday, May 10, 2013 9:08 AM

All replies

  • Hi,

    We can use PropertySet class to pass value into MFT. Hope it can help you
    http://msdn.microsoft.com/en-us/library/windows/apps/windows.foundation.collections.propertyset

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 13, 2013 8:59 AM
  • Hello,

    What do you mean by "sometimes"? Are you using the MFSetAttributeRatio function to set the frame rate value? What values are you trying to use?

    If you can generate a dump file with full memory and handle information when the Finalize call hangs I can take a look and possibly tell you why it is hanging. Please zip it up and put it on your SkyDrive.

    Thanks,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, May 13, 2013 9:11 PM
    Moderator
  • Dear James:

    I try to make a mp4(h.264) from array of image and each image has the same duration, so i set the framerate according to the duration if duration is 100ms i'll set frame rate to 10 using MFSetAttributeRatio .  but if i write a lot of images with certain duration into video  the Finalize will not return.  

    Thanks.


    • Edited by Yixiong Wednesday, May 15, 2013 6:44 AM
    Wednesday, May 15, 2013 6:41 AM
  • Yes, using propertySet can configure the MFT, But how to configure the encoder using in sinkWriter on WinRT?
    Wednesday, May 15, 2013 7:02 AM
  • It should be possible to use an IPropertyStore to configure the SinkWriter encoder via SetInputMediaType but I don't understand how a PropertySet could be used instead of an IPropertyStore. Any pointers on how to alter the following code to work?

    PROPVARIANT prop;
    IPropertyStore* pPropertyStore = NULL;
    //NOT SUPPORTED IN WINSTORE: HRESULT hr = PSCreateMemoryPropertyStore(__uuidof(IPropertyStore), (void**)&pPropertyStore);
    if (SUCCEEDED(hr))
    {
    	PROPERTYKEY key;
    	key.fmtid = CODECAPI_AVEncCommonQualityVsSpeed;
    	prop.vt = VT_UI4;
    	prop.lVal = 0;
    	hr = pPropertyStore->SetValue(key, prop);
    }
    if (SUCCEEDED(hr))
    {
    	ComPtr<IMFAttributes> pEncoderParameters;
    	if (SUCCEEDED(hr)) hr = MFCreateAttributes(&pEncoderParameters, 1);
    	if (SUCCEEDED(hr)) hr = pEncoderParameters->SetUnknown(MF_SINK_WRITER_ENCODER_CONFIG, pPropertyStore);
    	if (SUCCEEDED(hr)) hr = sinkWriter->SetInputMediaType(streamIndex, _inputMediaType.Get(), pEncoderParameters.Get());
    }
    PropVariantClear(&prop);

    Wednesday, July 16, 2014 10:31 PM