VPU Decoding after a seek into the video

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

VPU Decoding after a seek into the video

跳至解决方案
1,075 次查看
ronssehervé
Contributor I

Hi,

I'm developping a video recorder/player application on an Imx53 board. I use VPU's codec mpeg4 to decode the video frames (from a video file). FFmpeg allow to use the AVI container for video storage.

When exclusive playback video, the decoding is correct. The problem occurs when I do a forward (or rewind) in the video :

Playing video, start decoding :

1. Fill vpu buffer with encoded mpeg4 frames

2. Start one frame decoding : vpu_DecStartOneFrame()

3. Wait for completion decoding : while( vpu_IsBusy() !=0) { fill_vpu_buffer(); vpu_WaitForInt(); }

4. Catch up the result : vpu_DecGetOutputInfo() and vpu_DecClrDispFlag()

5. Display the decoded frame and return to step 2.

When seek into the video, begin the seek process after step 5 (playing) :

6. Flush the VPU input buffer : vpu_DecBitBufferFlush()

7. Seek into the video (to a IKeyFrame)

8. Fill vpu buffer with encoded mpeg4 frames : the first one is a IKey frame.

9. return to step 2 (playing).

After the seek process, the first decoded frame is dirty although it is a keyframe. Why these results ?


Thanks, best regards

标签 (2)
1 解答
585 次查看
LaurenPost
NXP Employee
NXP Employee

What you are seeing after you seek are delta frames referencing frames before the key frame that were never given to the VPU.

There are a few options, wait for an IDR frame which is not guaranteed in many content.

After the seek point, do not display b until a 2nd I or P frame is displayed.

Close and reopen VPU as this clears out reference of delta frames not given

In my experience closing and opening the VPU seems to solve almost all the problems for these type seek situations.  Memory does not have to be freed or cleared on this reset case.

在原帖中查看解决方案

0 项奖励
1 回复
586 次查看
LaurenPost
NXP Employee
NXP Employee

What you are seeing after you seek are delta frames referencing frames before the key frame that were never given to the VPU.

There are a few options, wait for an IDR frame which is not guaranteed in many content.

After the seek point, do not display b until a 2nd I or P frame is displayed.

Close and reopen VPU as this clears out reference of delta frames not given

In my experience closing and opening the VPU seems to solve almost all the problems for these type seek situations.  Memory does not have to be freed or cleared on this reset case.

0 项奖励