Skip to main content

 none
Adding media information like title to mp4 file via SinkWriter RRS feed

  • Question

  • Hi,

    I'm using the SinkWriter example from docs.microsoft.com/en-us/windows/win32/medfound/tutorial--using-the-sink-writer-to-encode-video. I would like to add a title to the mp4 file generated similar to the following.

    _bstr_t strTitle =L"dksldk";

    CComPtr<IWMHeaderInfo> pHeaderInfo;
    ComCheck(m_pWriter->QueryInterface( IID_IWMHeaderInfo, (void**)&pHeaderInfo ));
    ComCheck(pHeaderInfo->SetAttribute( 0,  g_wszWMTitle, 
    WMT_TYPE_STRING, (BYTE*)(wchar_t *)strTitle, 2*(strTitle.length()+1)));

    Could someone please help me with this?

    Regards,

    Shyamala

    Tuesday, November 12, 2019 7:55 AM

All replies

  • Hi,

    Are you looking for ASF Media Sinks?

    Adding Metadata to the File Sink:After Creating the ASF file sink, it must be configured with information about the streams and encoding information in the output file. These procedures are described in Adding Stream Information to the ASF File Sink and Setting Properties in the File Sink. In addition, You can also add metadata information includes name/value pairs such as "Author", Title". This topic describes the process of adding metadata information to the file sink so that it appears in the final ASF Header Object.

    Best regards,

    Jeffrey


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 12, 2019 9:16 AM
  • Hi Jeffrey,

    I'm using IMFSinkWriter to create AVI/MP4 files.

    Regards,

    Shyamala

    Tuesday, November 12, 2019 9:47 AM
  • Hi,

    As MSDN document said, there is no methods of IMFSinkWriter to implement this function.

     

    Best regards,

    Jeffrey


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, November 13, 2019 6:16 AM
  • Hi Roman,

    Thank you, I'll try this immediately.

    Regards,

    Shyamala

    Wednesday, November 13, 2019 8:12 AM
  • Hi Roman,

    I tried your sample,it is working perfectly for mp4 file. But when I try the same with an avi file, I'm getting "Access Denied" error on SHGetPropertyStoreFromParsingName.

    I've checked the file's properties and even ran the exe with elevated privileges, but of no use.

    Regards,

    Shyamala

    Wednesday, November 13, 2019 9:22 AM
  • Quite possible, a different handler is used for AVI and as the format is, let us be honest, out of date, no wonder it might be limited to reading only. Or another possible reason is that you still have the file open and so it's not available for write access at the moment you are trying to update its properties.

    http://alax.info/blog/tag/directshow

    Wednesday, November 13, 2019 9:36 AM