Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    QMediaPlayer: setPosition jumps to key frames

    General and Desktop
    2
    5
    2304
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      fober last edited by

      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

      1 Reply Last reply Reply Quote 0
      • A
        andreyc last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • F
          fober last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • A
            andreyc last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • F
              fober last edited by

              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().

              1 Reply Last reply Reply Quote 0
              • First post
                Last post