Hello
I am working on capturing video from device using MFT where in I used IMFCaptureRecordSink for recording captured video.
HRESULT ConfigureVideoEncoding(IMFCaptureSource *pSource, IMFCaptureRecordSink *pRecord, REFGUID guidEncodingType) { IMFMediaType *pMediaType = NULL; IMFMediaType *pMediaType2 = NULL; GUID guidSubType = GUID_NULL; IMFMediaSource **ppMediaSource = NULL; // Configure the video format for the recording sink. HRESULT hr = pSource->GetCurrentDeviceMediaType((DWORD)MF_CAPTURE_ENGINE_PREFERRED_SOURCE_STREAM_FOR_VIDEO_RECORD , &pMediaType); if (FAILED(hr)) { goto done; } hr = CloneVideoMediaType(pMediaType, guidEncodingType, &pMediaType2); if (FAILED(hr)) { goto done; } hr = pMediaType->GetGUID(MF_MT_SUBTYPE, &guidSubType); if(FAILED(hr)) { goto done; } if(guidSubType == MFVideoFormat_H264_ES || guidSubType == MFVideoFormat_H264 || guidSubType == MFVideoFormat_YUY2) { //When the webcam supports H264_ES or H264, we just bypass the stream. The output from Capture engine shall be the same as //the native type supported by the webcam hr = pMediaType2->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_YUY2); } else { UINT32 uiEncodingBitrate; hr = GetEncodingBitrate(pMediaType2, &uiEncodingBitrate); if (FAILED(hr)) { goto done; } hr = pMediaType2->SetUINT32(MF_MT_AVG_BITRATE, uiEncodingBitrate); } if (FAILED(hr)) { goto done; } // Connect the video stream to the recording sink. DWORD dwSinkStreamIndex; if (FAILED(hr)) { goto done; } hr = pRecord->AddStream((DWORD)MF_CAPTURE_ENGINE_PREFERRED_SOURCE_STREAM_FOR_VIDEO_RECORD, pMediaType2, NULL, &dwSinkStreamIndex); if (hr == MF_E_INVALIDSTREAMNUMBER) { //If an audio device is not present, allow video only recording hr = S_OK; } done: SafeRelease(&pMediaType); SafeRelease(&pMediaType2); return hr; }
Now I need bytestream from the captured video. I require bytestream for creating ismv.
Please suggest me how can I get Bytestream from IMFCaptureSink.
Thanks