acces to data stream (KLV) with windows media-foundation

85 views Asked by At

Is there any way to acces data stream with Windows Media Foundation ?

I have a video stream that contains tree streams: Audio, video and Data stream When I opend the file with ffmpeg I can access the three stream:

  • AVMEDIA_TYPE_AUDIO
  • AVMEDIA_TYPE_VIDEO
  • AVMEDIA_TYPE_DATA

This image show more details about the data stream I wanted to retrieve. enter image description here

With windows media-foundation I can only see audio and video streams.

IMFMediaSource* pVideoSource = NULL;
IMFSourceReader* pVideoReader = NULL;           
....
....
while (pVideoReader->GetStreamSelection(stmIndex, &isSelected) == S_OK) {
      printf("Stream %d is selected %d.\n", stmIndex, isSelected);

      CHECK_HR(pVideoReader->GetCurrentMediaType(stmIndex, &pStmMediaType), "Failed to get media type for selected stream.");

      std::cout << "Media type: " << GetMediaTypeDescription(pStmMediaType) << std::endl;

      GUID majorMediaType;
      pStmMediaType->GetGUID(MF_MT_MAJOR_TYPE, &majorMediaType);
      if (majorMediaType == MFMediaType_Audio) {
          std::cout << "Source audio stream index is " << stmIndex << "." << std::endl;
      }
      else if (majorMediaType == MFMediaType_Video) {
          std::cout << "Video stream index is " << stmIndex << "." << std::endl;
      }
      stmIndex++;
      SAFE_RELEASE(pStmMediaType);
  }

**Output **

Stream 0 is selected 1. Media type: MFMediaType_Audio: MF_MT_AUDIO_AVG_BYTES_PER_SECOND=16031, MF_MT_AUDIO_BLOCK_ALIGNMENT=1, {33026EE0-E387-4582-AE0A-34A2AD3BAA18}=1, MF_MT_AUDIO_NUM_CHANNELS=2, MF_MT_MAJOR_TYPE=MFMediaType_Audio, MF_MT_AUDIO_SAMPLES_PER_SECOND=48000, MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION=254, MF_MT_AUDIO_PREFER_WAVEFORMATEX=1, MF_MT_USER_DATA=, MF_MT_FIXED_SIZE_SAMPLES=1, MF_MT_AAC_PAYLOAD_TYPE=1, MF_MT_ALL_SAMPLES_INDEPENDENT=1, MF_MT_SAMPLE_SIZE=1, MF_MT_SUBTYPE=MFAudioFormat_AAC, Source audio stream index is 0. Stream 1 is selected 1. Media type: MFMediaType_Video: MF_MT_FRAME_SIZE=W:1920 H: 1080, MF_MT_MPEG_SEQUENCE_HEADER=, MF_MT_MAJOR_TYPE=MFMediaType_Video, MF_MT_AM_FORMAT_TYPE={E06D80E3-DB46-11CF-B4D1-00805F6CBBEA}, MF_MT_MPEG2_LEVEL=41, MF_MT_MPEG2_PROFILE=66, MF_MT_FIXED_SIZE_SAMPLES=1, MF_MT_FRAME_RATE=25/1, MF_MT_PIXEL_ASPECT_RATIO=1:1, MF_MT_SAMPLE_SIZE=1, MF_MT_INTERLACE_MODE=2, MF_MT_SUBTYPE={3F40F4F0-5622-4FF8-B6D8-A17A584BEE5E}, Video stream index is 1. Source media type count: 1, is first stream selected 1. Default output media type for source reader: MFMediaType_Video: MF_MT_FRAME_SIZE=W:1920 H: 1080, MF_MT_MPEG_SEQUENCE_HEADER=, MF_MT_MAJOR_TYPE=MFMediaType_Video, MF_MT_AM_FORMAT_TYPE={E06D80E3-DB46-11CF-B4D1-00805F6CBBEA}, MF_MT_MPEG2_LEVEL=41, MF_MT_MPEG2_PROFILE=66, MF_MT_FIXED_SIZE_SAMPLES=1, MF_MT_FRAME_RATE=25/1, MF_MT_PIXEL_ASPECT_RATIO=1:1, MF_MT_SAMPLE_SIZE=1, MF_MT_INTERLACE_MODE=2, MF_MT_SUBTYPE={3F40F4F0-5622-4FF8-B6D8-A17A584BEE5E},

I also looked on the sample metadata. I didn't find anything. MFSampleExtension_CaptureMetadata

 HRESULT hr = videoSample->GetUnknown(MFSampleExtension_CaptureMetadata, IID_IMFAttributes, (void**)&pAttributes);

Result

hr = 0xc00d36e6 : The requested attribute was not found. access to data stream with media-foundation

0

There are 0 answers