Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

H264 decoder player: seek operation problem

Rock_L_
Beginner
1,599 Views

Hi,

I use h264_dec_filter.dll from the sample code of the Intel Media SDK in my directshow player.
The decoding function is great and the player can play the H.264 video.
But when I use IMediaSeeking::SetPositions to seek the media to a specific time, the video screen will be frozen.

I debug the code
CDecVideoFilter::Receive(IMediaSample* pSample)
{
    ...
    sts = m_pDecoder->RunDecode(&mfxBS, pSurfaceOut);  
    ...

}

The value of the sts is -10 after seeking.
And then the program won't go into the Receive function

Does anyone know how to fix this problem?
Or I do something wrong?
Your assistance will be greatly appreciated. Thank you.

0 Kudos
1 Solution
Petter_L_Intel
Employee
1,599 Views

Hi Rock,

oh, the perils of automatic spelling correction. I meant to write "I do not see anything wrong with the clip." not "I do not see anything working with the clip.".  :)

At that time I did not test the clip using dshowplayer. I just verified that the stream structure made sense.  I just now made the same changes to dshowplayer you have made and I do see the same issue.

Note that the Media SDK DirectShow samples have not developed or validated to work with all possible pipeline designs. It is likely that the use of the AVI splitter requires additional changes to the Media SDK DirectShow decoder samples. I suggest you build the H.264 decoder from the SDK samples and debug the behavior of stream repositioning, comparing the behavior when using the MP4 splitter vs. the AVI splitter to try to isolate the difference. I suspect the issue may be due to missing or different layout of SPS/PPS headers. Check  "mfx_video_dec_filter.cpp", function NewSegment(...)

Other developers active on this forum may have past experience on how to make this work. Community, please share any ideas with Rock if possible.

Regards,
Petter

View solution in original post

0 Kudos
10 Replies
Petter_L_Intel
Employee
1,599 Views

Hi Rock,

Seeking is supported by the directshow sample decoder. It's hard to say what may be causing your issues.

I suggest you explore the src code for the directshow player ("sample_dshow_player") which is part of the samples. This sample showcases how to do seeking.

Regards,
Petter

0 Kudos
Rock_L_
Beginner
1,599 Views

Hi Petter,

Thanks you for your reply.

I try the "sample_dshow_player" and still get the same problem:  the video will be stop.when seek to an another time.
But I did some modify of the "sample_dshow_player".
The Intel Media SDK MP4 Splitter doesn't support my video, so I change the splitter into 
CLSID_AviSplitter.
Does it cause the problem?

Regards
Rock

0 Kudos
Petter_L_Intel
Employee
1,599 Views

Hi Rock,

What does your stream look like?  I'm assuming it has I-frames dispersed throughout the stream. If not, seeking will not operate properly.

Replacing the splitter may be the cause of your issue, but hard to say what may be exact reason for the failure.

Regards,
Petter

0 Kudos
Rock_L_
Beginner
1,599 Views

Hi Petter,

Following is my video format.

Video
ID = 0
Format = AVC
Format/Info = Advanced Video Codec
Format profile = Main@L4.1
Format settings, CABAC = Yes
Format settings, ReFrames  = 2 frames
Format settings, GOP: M=3, N=8
Codec ID  = H264
Duration = 1mn 0s
Bit rate = 12.5 Mbps
Width = 1920 pixels
Height  = 1080 pixels
Display aspect ratio  = 16:9
Frame rate = 30.000 fps
Color space  = YUV
Chroma subsampling =  4:2:0
Bit depth = 8 bits
Scan type = Progressive
Bits/(Pixel*Frame) = 0.202
Stream size = 90.0 MiB (99%)

Could I upload that video to let you see?

Sincere thanks
Rock

0 Kudos
Petter_L_Intel
Employee
1,599 Views

Hi Rock,

Thanks. Feel free to share the video clip.

Regards,
Petter

0 Kudos
Rock_L_
Beginner
1,599 Views

Hi Petter,

The Attachments is my video

Sincere thanks
Rock

0 Kudos
Petter_L_Intel
Employee
1,599 Views

Hi Rock,

thanks for sharing the content.

I do not see anything working with the clip.

I suspect the issue you are facing are related to the way your splitter interacts with the decoder, more specifically how it reports (or not report..) frame type or status during a reposition operation. During reposition you need to make sure there is a valid SPS/PPS header ahead of the I-frame to which you are repositioning the stream as described in the Media SDK Developers Guide document (part of SDK package), chapter: 3.4: Decoder Stream Repositioning.  It is possible your splitter is not complying to this.

You could also try other Dshow splitters such as LAV or Haali.

Regards,
Petter

 

 

0 Kudos
Rock_L_
Beginner
1,599 Views

Hi Petter,

Thank you for your help.

I try the LAV Splitter and it still have the problem with the seeking.

My "sample_dshow_player" can work because I made some modify of it.

At the "dshowplayer.h"

1. I add the CLSID_AviSplitter to the splitter pool.

static const GUID guidSplitters[]           = {CLSID_MP4SplitterFilter, CLSID_MPEG2SplitterFilter, CLSID_AviSplitter};

2. Reorder the decoders to make the CLSID_H264DecFilter be the first one.

static const GUID guidVideoDecoders[]       = {CLSID_H264DecFilter, CLSID_VC1DecFilter, CLSID_MPEG2DecFilter};

Sorry for that I forgot to tell you what have I modified.
I think after this change you can play the clip with the "sample_dshow_player"

Regards,
Rock

0 Kudos
Petter_L_Intel
Employee
1,600 Views

Hi Rock,

oh, the perils of automatic spelling correction. I meant to write "I do not see anything wrong with the clip." not "I do not see anything working with the clip.".  :)

At that time I did not test the clip using dshowplayer. I just verified that the stream structure made sense.  I just now made the same changes to dshowplayer you have made and I do see the same issue.

Note that the Media SDK DirectShow samples have not developed or validated to work with all possible pipeline designs. It is likely that the use of the AVI splitter requires additional changes to the Media SDK DirectShow decoder samples. I suggest you build the H.264 decoder from the SDK samples and debug the behavior of stream repositioning, comparing the behavior when using the MP4 splitter vs. the AVI splitter to try to isolate the difference. I suspect the issue may be due to missing or different layout of SPS/PPS headers. Check  "mfx_video_dec_filter.cpp", function NewSegment(...)

Other developers active on this forum may have past experience on how to make this work. Community, please share any ideas with Rock if possible.

Regards,
Petter

0 Kudos
Rock_L_
Beginner
1,599 Views

Hi Peter,

I got that working. I wrote a transform filter which adds SPS/PPS header of the i-frame.

Thanks a lot for pointing me to the right direction :)

Regards,
Rock

0 Kudos
Reply