Want to pass H264 data from IMFSample to cloud

Donthu, Gangadhar 41 Reputation points
2022-12-27T04:59:17.857+00:00

Hi,

(Media Foundation Class based)

I am receiving H264/H265 stream from camera asynchronously through "OnReadSample". I would like to pass H264/H265 data to a cloud, not IMFSample type. Please suggest and show me a link to working example if possible.

Thanks
GD

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,438 questions
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 15,446 Reputation points Microsoft Vendor
    2022-12-27T06:46:26.34+00:00

    I see, you can use [ConvertToContiguousBuffer][1] and IMFMediaBuffer::Lock to get the byte buffer.

    IMFMediaBuffer *mediaBuffer = NULL;  
    BYTE *pData = NULL;  
    
      
    pSample->ConvertToContiguousBuffer(&mediaBuffer);  
    hr = mediaBuffer->Lock(&pData, NULL, NULL);  
    ```*************************************************************************    
    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".    
    Note: Please follow the steps in our [documentation][3] to enable e-mail notifications if you want to receive the related email notification for this thread.    
        
      [3]: https://learn.microsoft.com/en-us/answers/articles/67444/email-notifications.html    
      [1]: https://learn.microsoft.com/en-us/windows/win32/api/mfobjects/nf-mfobjects-imfsample-converttocontiguousbuffer    
      [2]: https://learn.microsoft.com/en-us/windows/win32/api/mfobjects/nf-mfobjects-imfmediabuffer-lock    
        
        
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful