VPU Decoding after a seek into the video

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VPU Decoding after a seek into the video

Jump to solution
1,077 Views
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

Labels (2)
1 Solution
587 Views
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.

View solution in original post

0 Kudos
1 Reply
588 Views
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 Kudos