Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Grab frames from video
Forum Updated to NodeBB v4.3 + New Features

[Solved] Grab frames from video

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 5.4k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    jib218
    wrote on last edited by
    #1

    Hi,

    i want to grab frames from a video. I'm new to qt and i'm using qt 4.7.

    Example:
    User starts video -> stops -> Now I want to grab for instance all 30 frames before this position and all 20 frames after this position for further computations.

    I have looked through the documentation, but neither phonon nor qtmultimedia seem to be capable of accessing single video frames.

    Now my question is, is it possible with qt 4 or do I have to call libs like ffmpeg directly?
    Also will qt5 provide such methods?

    Thanks!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      I can't speak for the Qt5 code, but I believe you currently have to talk to the libs directly to get that fine-grained control.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jib218
        wrote on last edited by
        #3

        If anyone is interested in this topic, I solved it with opencv (VideoCapture), which seems to be the easiest way to grab frames from a video.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          veeraps
          wrote on last edited by
          #4

          I would appreciate if you could provide sample code.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jib218
            wrote on last edited by
            #5

            Well, for the opencv part I recommend the documentation, which explains very good how the VideoCapture class works ( "link":http://opencv.willowgarage.com/documentation/cpp/highgui_reading_and_writing_images_and_video.html?highlight=videocapture#VideoCapture )

            With opencv you get a frame as "Mat"
            Now I converted it to a IplImage, like this:

            Mat mat = whereveritcomesfrom...
            IplImage ipl(mat);

            What is very cheap, because it only changes the header, but not the data.

            Then I adapted code from this "blog":http://umanga.wordpress.com/2010/04/19/how-to-covert-qt-qimage-into-opencv-iplimage-and-wise-versa/ , which converts the IplImage to a QImage :)

            1 Reply Last reply
            0
            • V Offline
              V Offline
              veeraps
              wrote on last edited by
              #6

              Thanks for the information Ashika Umanga!

              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