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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    What do you mean by embed ? Use Qt's resource system ?

    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
      #3

      Yes, essentially this:

          Video {
              id: video
              width : parent.width
              height : parent.height
              source: "qrc:/video/qdvtest.mov"
      
              MouseArea {
                  anchors.fill: parent
                  onClicked: {
                      video.play()
                  }
              }
      
              focus: true
              Keys.onSpacePressed: video.playbackState == MediaPlayer.PlayingState ? video.pause() : video.play()
              Keys.onLeftPressed: video.seek(video.position - 5000)
              Keys.onRightPressed: video.seek(video.position + 5000)
          }
      
      1 Reply Last reply
      0
      • A Offline
        A Offline
        abanksdev
        wrote on last edited by
        #4

        Are there known size limitations for how large the video file that you use can be?

        Bhushan_SureB 1 Reply Last reply
        0
        • A abanksdev

          Are there known size limitations for how large the video file that you use can be?

          Bhushan_SureB Offline
          Bhushan_SureB Offline
          Bhushan_Sure
          wrote on last edited by
          #5

          @abanksdev hi, while running video code are you facing memory problem because of 133mb? if it's like that then i can help you, i have come across this situation.

          1 Reply Last reply
          0
          • A abanksdev

            Has anyone else had any problems embedding video in QML code? I'm trying to use a file that's 133 mb (without anything else in the app or the code) and it's taking forever to run. Does anyone have work arounds for this or advice?

            Thank you!

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #6

            @abanksdev from my experience, It takes about 5 minutes to compile and link around 20 mb of ressource files. 133 mb will take a lot longer, if it works at all.

            Why don't you ship the Moviefile seperaterly and load it from the system HD ? Do you really need a 133 mb movie in your binary file!?


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

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

              Hi,

              You should rather use a external binary resouce.

              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
                #8

                @SGaist I'm a little unclear as to what they're instructing me to do in the link you sent me. Do i have to create a resource file with the videos in it first and then register it in the cmd line?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9
                  1. You create a .qrc file
                  2. You use rcc to generate an external file
                  3. You add a call to registerResource in your sources to be able to access your data as if they were on different connections.

                  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
                    #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