QMediaPlayer: setPosition jumps to key frames
-
I want to jump to arbitrary position in a video (while the video don't play). When using a compressed format (H264), setPosition() jumps to the closest key frame (it seems to). How can I do to access images between key frames?
Here is the code
@
fMediaPlayer.play ();
fMediaPlayer.setPosition( pos );
fMediaPlayer.pause ();
@fMediaPlayer is a QMediaPlayer. Note that it works when the video is compressed as jpeg.
Any idea of what's wrong ?Dominique
-
I think it may depend on OS multimedia backend.
But in H.264 you have to start to decode from key-frame.
Because all other frames are just the differences between two key-frames, so nobody will be able to show it.If video is decoded as jpeg then all frames are full jpeg images.
I guess you have to have running decoder to jump between each frame in H.264.
-
If a decoder is running but the frames are not shown then you need to store or to drop the frames.
"Here":http://qt-project.org/doc/qt-5/videooverview.html#working-with-low-level-video-frames is a short info about how to work with the frames.
What is your use case, why do you need to setPosition() to all frames in a stream?
-