0

I've a written a simple code in Qt using OpenCVwhich records live video from webcam and saves it in .avi file format. I want to know if there's any way to store the same video in SQLite database.

Miki
  • 40,887
  • 13
  • 123
  • 202
Ryder389
  • 43
  • 1
  • 1
  • 12
  • 1
    store the video in a directory then save the video file path in the database – ArunKumar M N Apr 09 '19 at 11:08
  • 1
    Don't. Databases are designed to hold structured data, not huge binary streams. Store your video files on a normal filesystem in a consistent fashion (e.g. use a hash for the filenames) and store references to those files in your database. – Jonathon Reinhart Apr 09 '19 at 11:10
  • 1
    Possible duplicate of [How to store video content in SQLite database (not the video path)](https://stackoverflow.com/questions/54707299/how-to-store-video-content-in-sqlite-database-not-the-video-path) – Jonathon Reinhart Apr 09 '19 at 11:14
  • @JonathonReinhart Thanks! – Ryder389 Apr 09 '19 at 11:27

1 Answers1

2

Use the blob datatype - but a DB isn't the place to store such large datafiles. Stick the video on disk and put where the file is located in your DB. You'll find accessing it later is a lot easier 9as all the OS operations for streaming expect to find a file on disk to work with).

gbjbaanb
  • 51,617
  • 12
  • 104
  • 148