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.setPosition( pos );
fMediaPlayer is a QMediaPlayer. Note that it works when the video is compressed as jpeg.
Any idea of what's wrong ?
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.
bq. I guess you have to have running decoder to jump between each frame in H.264.
That's what I think too. Thus the question is how can I force decoding without playing.
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?
Thanks for the link. I'll give it a try.
I'm using video in a musical context. Arbitrary jump to any time location must be supported (while playing or not) and with accurate time synchronization with other medias. This is why I need setPosition().