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.9k 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
    20 Dec 2018, 02:38

    @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.

    J Offline
    J Offline
    JonB
    wrote on 20 Dec 2018, 09:44 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.

    J 1 Reply Last reply 20 Dec 2018, 09:47
    0
    • J JonB
      20 Dec 2018, 09:44

      @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.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 20 Dec 2018, 09:47 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

      J 1 Reply Last reply 20 Dec 2018, 10:39
      0
      • J jsulm
        20 Dec 2018, 09:47

        @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).

        J Offline
        J Offline
        JonB
        wrote on 20 Dec 2018, 10:39 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 :)

        J 1 Reply Last reply 20 Dec 2018, 11:42
        0
        • J JonB
          20 Dec 2018, 10:39

          @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 :)

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 20 Dec 2018, 11:42 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

          J 1 Reply Last reply 20 Dec 2018, 12:11
          0
          • J jsulm
            20 Dec 2018, 11:42

            @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.

            J Offline
            J Offline
            JonB
            wrote on 20 Dec 2018, 12:11 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.

            J 1 Reply Last reply 20 Dec 2018, 12:12
            0
            • J JonB
              20 Dec 2018, 12: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.

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 20 Dec 2018, 12:12 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

              J 1 Reply Last reply 20 Dec 2018, 12:14
              0
              • J jsulm
                20 Dec 2018, 12:12

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

                J Offline
                J Offline
                JonB
                wrote on 20 Dec 2018, 12:14 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".

                J 1 Reply Last reply 20 Dec 2018, 12:18
                0
                • J JonB
                  20 Dec 2018, 12:14

                  @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".

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 20 Dec 2018, 12:18 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

                  J 1 Reply Last reply 20 Dec 2018, 12:20
                  0
                  • J jsulm
                    20 Dec 2018, 12:18

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

                    J Offline
                    J Offline
                    JonB
                    wrote on 20 Dec 2018, 12:20 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. :)

                    J 1 Reply Last reply 20 Dec 2018, 12:21
                    0
                    • J JonB
                      20 Dec 2018, 12:20

                      @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. :)

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 20 Dec 2018, 12:21 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

                      16/16

                      20 Dec 2018, 12:21

                      • Login

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