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. Reading in video files?
Forum Updated to NodeBB v4.3 + New Features

Reading in video files?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 455 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.
  • W Offline
    W Offline
    whatabout
    wrote on last edited by whatabout
    #1

    Is it possible to open and read video files, in order to obtain the frames and audio from them? I don't want to actually play the video or audio content, just parse and decode it.

    In the old days on Windows we could use Video For Windows which let us do this with AVI files. Anything similar would help, although I'm on Linux now. I want to avoid using ffmpeg's libraries which appear disorganized.

    1 Reply Last reply
    0
    • W whatabout

      @SGaist That seems aimed at playing video files, not dissecting them.

      W Offline
      W Offline
      wrosecrans
      wrote on last edited by
      #5

      @whatabout It's absolutely possible with Qt, but it's a massive pain in the neck. Check out QVideoProbe https://doc.qt.io/qt-5/qvideoprobe.html But yeah, that will get you pixels, but it's still assuming you want to "play" a video.

      Personally, I use a library called ffms2. It's a wrapper around FFMPEG that provides a simple API for getting pixels and audio for a frame from a video file. It's not optimal in terms of performance because it bypasses hardware video decoding and has an indexing step when you first open a file, but if you just want pixels in memory to do your own image processing it's still the simplest API I have used. Getting a frame once the video is open and ready is just

      const FFMS_Frame *curframe = FFMS_GetFrame(videosource, framenumber, &errinfo);
      

      No weird async callbacks to set up and GPU memory blocks to try and map and whatnot.

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

        Hi,

        Did you already check the Qt Multimedia module ?

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

        W 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

          Did you already check the Qt Multimedia module ?

          W Offline
          W Offline
          whatabout
          wrote on last edited by
          #3

          @SGaist That seems aimed at playing video files, not dissecting them.

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

            The module has seen a rewrite in Qt 6 and should allow you to get both audio and video frame for processing before rendering them.

            If that is not enough, you might want to explain more precisely what you want to do.

            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
            • W whatabout

              @SGaist That seems aimed at playing video files, not dissecting them.

              W Offline
              W Offline
              wrosecrans
              wrote on last edited by
              #5

              @whatabout It's absolutely possible with Qt, but it's a massive pain in the neck. Check out QVideoProbe https://doc.qt.io/qt-5/qvideoprobe.html But yeah, that will get you pixels, but it's still assuming you want to "play" a video.

              Personally, I use a library called ffms2. It's a wrapper around FFMPEG that provides a simple API for getting pixels and audio for a frame from a video file. It's not optimal in terms of performance because it bypasses hardware video decoding and has an indexing step when you first open a file, but if you just want pixels in memory to do your own image processing it's still the simplest API I have used. Getting a frame once the video is open and ready is just

              const FFMS_Frame *curframe = FFMS_GetFrame(videosource, framenumber, &errinfo);
              

              No weird async callbacks to set up and GPU memory blocks to try and map and whatnot.

              W 1 Reply Last reply
              1
              • W whatabout has marked this topic as solved on
              • W wrosecrans

                @whatabout It's absolutely possible with Qt, but it's a massive pain in the neck. Check out QVideoProbe https://doc.qt.io/qt-5/qvideoprobe.html But yeah, that will get you pixels, but it's still assuming you want to "play" a video.

                Personally, I use a library called ffms2. It's a wrapper around FFMPEG that provides a simple API for getting pixels and audio for a frame from a video file. It's not optimal in terms of performance because it bypasses hardware video decoding and has an indexing step when you first open a file, but if you just want pixels in memory to do your own image processing it's still the simplest API I have used. Getting a frame once the video is open and ready is just

                const FFMS_Frame *curframe = FFMS_GetFrame(videosource, framenumber, &errinfo);
                

                No weird async callbacks to set up and GPU memory blocks to try and map and whatnot.

                W Offline
                W Offline
                whatabout
                wrote on last edited by
                #6

                @wrosecrans
                Have you tried compiling ffms2 lately?
                I'm finding the autogen.sh is giving errors.
                There's no configure script.

                W 1 Reply Last reply
                0
                • W whatabout

                  @wrosecrans
                  Have you tried compiling ffms2 lately?
                  I'm finding the autogen.sh is giving errors.
                  There's no configure script.

                  W Offline
                  W Offline
                  wrosecrans
                  wrote on last edited by
                  #7

                  @whatabout I just use a CMake build system in my own project. I haven't bothered keeping it particularly up to date or anything, but feel free to grab my CMake as a starting point if it's useful: https://github.com/wrosecrans/ffms2/blob/master/CMakeLists.txt May need some tweaks to keep up with upstream. I link it to an ffmpeg from vcpkg.

                  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