Im currently designing the video table for a CMS Im working on and Im a little stumped as to how I should set it up. I need the table to store the following information:
- content_id: a FK referencing the main content table
- The file location for 6 versions: 240p, 480p, and 1080p each in 2 codecs
- The availability of each of the video qualities
- The status of each of the video qualities (Whether they are done being transcoded or not)
So far What I have looks like this:
CREATE TABLE tbl_content_video (
con_id INT NOT NULL AUTO_INCREMENT,
vid_length INT NOT NULL,
flv_1080_file_loc VARCHAR(255) DEFAULT NULL,
flv_480_file_loc VARCHAR(255) DEFAULT NULL,
flv_240_file_loc VARCHAR(255) NOT NULL,
vp8_1080_file_loc VARCHAR(255) DEFAULT NULL,
vp8_480_file_loc VARCHAR(255) DEFAULT NULL,
vp8_240_file_loc VARCHAR(255) NOT NULL,
FOREIGN KEY (con_id) REFERENCES tbl_content (con_id)
);
Im still uncertain on the best solution for storing the available qualities and their availability status any thoughts are much appreciated
There’s no reason for storing the individual file locations. Most of that is going to be highly repetitive pathing data. Instead, keep the paths in a separate table or hard-coded into a config file, and simply use those paths plus the id of the video (
con_it?) to build a path pointing at the appropriate version of the video.As for the status stuff, keep a field for each video type you suport, and figure out some values to put in there. 0 – not available, 1 – transcoding, 2- error, 3- good to go, etc…