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. Send and retrieve video to database sql from disk
Forum Updated to NodeBB v4.3 + New Features

Send and retrieve video to database sql from disk

Scheduled Pinned Locked Moved Solved General and Desktop
16 Posts 4 Posters 1.8k 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.
  • G greencow

    @Christian-Ehrlicher Thank you for replying! I was thinking to play video from the database like the database act as the server to send through to the client. I think my concept is wrong, thank you for pointing it out.

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #7

    @greencow
    As @jsulm suggests.

    Storing a large video in a database is not good for what you want. The video player cannot play it from there, so the first thing which will have to be done every time is to extract the whole huge data from the database to store it into a local file for the video player to play from there. That's really slow! Keeping the video in a local file is going to be way more appropriate.

    jsulmJ 1 Reply Last reply
    0
    • JonBJ JonB

      @greencow
      As @jsulm suggests.

      Storing a large video in a database is not good for what you want. The video player cannot play it from there, so the first thing which will have to be done every time is to extract the whole huge data from the database to store it into a local file for the video player to play from there. That's really slow! Keeping the video in a local file is going to be way more appropriate.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #8

      @JonB @greencow One improvement for my suggestion: store root path to the directory containing the video files once, then for each video only store relative path (relative to root path). This way you can easily move all videos to a different location if needed without the need to change all paths in the database (only the root path needs to be changed then).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      JonBJ 1 Reply Last reply
      0
      • jsulmJ jsulm

        @JonB @greencow One improvement for my suggestion: store root path to the directory containing the video files once, then for each video only store relative path (relative to root path). This way you can easily move all videos to a different location if needed without the need to change all paths in the database (only the root path needs to be changed then).

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #9

        @jsulm , @greencow
        In that case, personally I would not store the root path in the database! It has nothing to do with the database/data, and any operations which extract a data row from the db to file will have to be performed 100% client-side to a file. So what directory you choose to extract to is an arbitrary decision (e.g. could vary from machine to machine), I would decide that purely in client-side code :)

        jsulmJ 1 Reply Last reply
        0
        • JonBJ JonB

          @jsulm , @greencow
          In that case, personally I would not store the root path in the database! It has nothing to do with the database/data, and any operations which extract a data row from the db to file will have to be performed 100% client-side to a file. So what directory you choose to extract to is an arbitrary decision (e.g. could vary from machine to machine), I would decide that purely in client-side code :)

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #10

          @JonB I think you misunderstood my point. If both, database and files, are stored on server side and you store the path to the file in the database then it makes sense (in my opinion) to only store relative path in the database. Where the client stores the file later is completely irrelevant for the server, but the server needs to know where the file is stored (on server side) to be able to provide it to the client.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          JonBJ 1 Reply Last reply
          0
          • jsulmJ jsulm

            @JonB I think you misunderstood my point. If both, database and files, are stored on server side and you store the path to the file in the database then it makes sense (in my opinion) to only store relative path in the database. Where the client stores the file later is completely irrelevant for the server, but the server needs to know where the file is stored (on server side) to be able to provide it to the client.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #11

            @jsulm
            How can a SQL server, even armed with a full path to a file, serve/"provide" that file? SQL (as SQL) can't do that --- it's a file, not a row in a database.

            jsulmJ 1 Reply Last reply
            0
            • JonBJ JonB

              @jsulm
              How can a SQL server, even armed with a full path to a file, serve/"provide" that file? SQL (as SQL) can't do that --- it's a file, not a row in a database.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #12

              @JonB Well, yes with raw SQL you can't. But if you're accessing some APIs (like REST) server can do this.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              JonBJ 1 Reply Last reply
              0
              • jsulmJ jsulm

                @JonB Well, yes with raw SQL you can't. But if you're accessing some APIs (like REST) server can do this.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #13

                @jsulm
                OK, but the OP said "video from disk to database sql". Not "oh by the way I have some other RESTful server API available to me".

                jsulmJ 1 Reply Last reply
                0
                • JonBJ JonB

                  @jsulm
                  OK, but the OP said "video from disk to database sql". Not "oh by the way I have some other RESTful server API available to me".

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  @JonB In this case he needs to store the video as binary blob in the db...

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  JonBJ 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @JonB In this case he needs to store the video as binary blob in the db...

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #15

                    @jsulm
                    Which is where we started from :) And as I said will be terribly inefficient, as the whole blob will need extracting and saving to file each time (by the client) in order to access the video. :)

                    jsulmJ 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @jsulm
                      Which is where we started from :) And as I said will be terribly inefficient, as the whole blob will need extracting and saving to file each time (by the client) in order to access the video. :)

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #16

                      @JonB And here we are again at the point to suggest to not to store it in the db :-)

                      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