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. Qt Multimedia : How to convert/re-encode a video file

Qt Multimedia : How to convert/re-encode a video file

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 4.2k 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.
  • H Offline
    H Offline
    Harry123
    wrote on last edited by
    #1

    I would like to be able, using Qt Multimedia, to convert a video or audio file to another container/codec format, meaning re-encode the file.

    Could someone please indicate whether this can be accomplished, and if yes, how ?
    A link to an example will be wonderful.

    As a related question, I suppose that for listing the video & audio codecs that are available for encoding, one would use the functions QMediaRecorder::supportedAudioCodecs and QMediaRecorder::supportedVideoCodecs. Is that correct ?

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

      Hi,

      To convert files, I'd recommend calling the ffmpeg executable from your Qt application with QProcess. You can also use the libs from ffmpeg and write the code based on it within your application.

      Hope it helps.

      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
      • H Offline
        H Offline
        Harry123
        wrote on last edited by
        #3

        I have seen this advice before, but was hoping that something has improved since then.
        Does that mean that you don't recommend using Qt Multimedia ?

        I would have expected Qt to incorporate GStreamer as its video interface.
        Is Qt hit also by the dreaded "Not invented here" syndrome?

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

          I mean that QtMultimedia is not the right tool to do video conversion.

          On Linux Qt uses gstreamer as backend.

          But again, converting video files from different formats in different formats is currently not something you should try to do with QtMultimedia. It uses what the OS provides and depending on your target (I'm guessing Linux) you won't have all the codecs you may need/want. Using FFMPEG, you have the Swiss Army Knife of video converter. Or if you are used to gstreamer, there also the QtGStreamer module that might be of interest.

          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
          • H Offline
            H Offline
            Harry123
            wrote on last edited by
            #5

            This should work also on Windows, where GStreamer is available and working.
            The hint of QtGStreamer was useful, but the problem is that it is not part of the Qt release, so at least for Windows I'll have to compile it and fix myself all problems.

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

              It's not an official Qt module, it's provided by the gstreamer project. So depending on your target OS, you'll to build it anyway.

              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
              • H Offline
                H Offline
                Harry123
                wrote on last edited by
                #7

                Thanks - I am now convinced that doing video conversions using Qt is a bad idea, unless one has lots of spare time on his hands.

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

                  Like I wrote before, doing video conversion is not an easy task and is currently outside of QtMultimedia's functionality and one of the best tool available for that is ffmpeg.

                  Note that you can very well mix other libraries like ffmpeg or gstreamer with Qt without any problem.

                  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
                  • J Offline
                    J Offline
                    Juli001
                    wrote on last edited by
                    #9
                    This post is deleted!
                    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