Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Size constraints for video for QML
Forum Updated to NodeBB v4.3 + New Features

Size constraints for video for QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
20 Posts 4 Posters 2.3k 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.
  • A Offline
    A Offline
    abanksdev
    wrote on last edited by
    #10

    @SGaist said in Size constraints for video for QML:

    You create a .qrc file
    You use rcc to generate an external file
    You add a call to registerResource in your sources to be able to access your data as if they were on different connections.

    My apologies, I had to move onto other tasks at work.

    I'm still unclear as to the ordering of things

    1.) I create a qrc file with nothing in it
    2.) Where do I call the command

    rcc -binary myresource.qrc -o myresource.rcc
    

    I tried to call it in the cmd line from the project directory to no avail
    Moreover, is myresource.rcc just the file name or the actual file itself?
    3.) Where do I point to the path of the file I want to create as a binary external resource? With

    QResource::registerResource("/path/to/myresource.rcc");
    

    Should it go in the .pro file?

    I really need someone to just spell it out for me, I'm new to this. An example would help me a whole lot.

    Thank you!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #11
      1. Why empty ? Its content should be the same as if you would build the resource within your application.
      2. Likely because you were calling it on an empty file.
      3. No, it should go in your application.

      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
      • A Offline
        A Offline
        abanksdev
        wrote on last edited by
        #12

        @SGaist @abanksdev said in Size constraints for video for QML:

        rcc -binary myresource.qrc -o myresource.rcc

        running it in my project dir results in the following:

        -bash: rcc: command not found
        

        I must be missing something totally obvious

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

          How did you install Qt ?

          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
          • A Offline
            A Offline
            abanksdev
            wrote on last edited by
            #14

            Nevermind I got that working.
            Once I have the rcc file should I delete the qrc file that I built it from?
            Moreover how do I set the source of a qml object to a rcc file?

            I assumed I should use the same path that i registered in QResource::registerResource("/path/to/myresource.rcc"); but when i do that, i don't get any errors, but yet the video im trying to display doesn't show up

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

              No you don't, the .qrc file is a part of your sources the same as the rest of your code.

              Again, no, use the same path as you would if it was embedded in your application.

              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
              • A Offline
                A Offline
                abanksdev
                wrote on last edited by
                #16

                So you mean I would use the qrc path 'qrc:/vidoes/filename' ?
                Can you give me an example. I'm extremely new to this, I'm not sure what you mean by 'as if it was embedded in your application'

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  abanksdev
                  wrote on last edited by
                  #17

                  Okay, for clarity's sake, here's how I'm implementing this. Let me know if anything is completely off base.

                  The file I am trying to embed in my application: myMovie.mov

                  1.) I add a new resource file called 'videos.qrc' and add myMovie.mov file to it
                  2.) In the project's directory I register rcc -binary videos.qrc -o videos.rcc
                  3.) In main.cpp in main() I use QResource::registerResource("C:/Users...qtProject/videos.rcc")
                  4.) In video.qml:

                  MediaPlayer {
                            id: video
                            source: "qrc:/videos/myMovie.mov"
                            autoPlay: true
                  }
                  
                  VideoOutput{
                            source: video
                  
                  }
                  
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #18

                    Might be a silly question but does that video work correctly if you give the full path to it ?

                    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
                    1
                    • A Offline
                      A Offline
                      abanksdev
                      wrote on last edited by
                      #19

                      Wow, good catch. It doesn't. Errrr
                      I tried giving it the qrc url and the local path. Unless it's just taking a long time to load, but I doubt that

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

                        Rather the QuickTime format is not supported by the backend.

                        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

                        • Login

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