Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QMediaPlayer setPosition shows previous frame first

QMediaPlayer setPosition shows previous frame first

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 Posts 2 Posters 629 Views
  • 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.
  • S Offline
    S Offline
    sssupply
    wrote on last edited by sssupply
    #1

    Hello,

    I am using QMediaPlayer to display a video and I have a step forward button that is supposed to move the video one frame forward.
    Here is the step forward function:

            def next_frame(self):
                self.progress_slider.setSliderPosition(self.progress_slider.value() + self.frame_increment_interval)
                self.player.setPosition(self.player.position() + self.frame_increment_interval)
                return
    

    but when I click the button it shows a previous frame first (like 100 frames in the past) before it moves to the next frame.
    Any idea why this behaviour exists?

    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The behaviour will depend on several factors. The video stream format, the container format, the backend you are using which depends on the OS you are on.

      The files you are playing may be highly compressed with few keyframes in between and you will not have each and every frame stored in your file. The step size also is important.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sssupply
        wrote on last edited by
        #3

        Oh okay. Is there a proper way to step through a video frame by frame using pyqt and without using openCV? I'd rather not have to swap back and forth between QMediaPlayer and openCV when playing the video normally and when I want to step through a video frame by frame. Also, I'm running this on Windows 10 with a mp4 video file.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved