Objective
Learn how to store MP4 video files in SynapCores with essential metadata. This foundation enables building video libraries, streaming platforms, and media management systems.
Step 1: Create Video Table
Create a table for storing MP4 videos with metadata.
CREATE TABLE videos (
id INTEGER PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT,
video_file VIDEO(MP4),
duration_seconds INTEGER,
file_size BIGINT,
resolution VARCHAR(20),
frame_rate DECIMAL(5, 2),
bitrate INTEGER,
uploaded_by VARCHAR(100),
is_public BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Step 2: Insert Sample Videos
Add sample video records.
INSERT INTO videos (id, title, description, duration_seconds, file_size, resolution, frame_rate, bitrate, uploaded_by) VALUES
(1, 'Product Introduction', 'Overview of our flagship product features', 180, 52428800, '1920x1080', 30.00, 5000000, 'marketing'),
(2, 'Tutorial: Getting Started', 'Step-by-step guide for new users', 600, 157286400, '1920x1080', 30.00, 4500000, 'training'),
(3, 'Company Overview', 'About our company and mission', 240, 78643200, '1920x1080', 24.00, 4000000, 'corporate'),
(4, 'Customer Testimonial', 'Client success story interview', 300, 94371840, '1920x1080', 30.00, 4200000, 'marketing'),
(5, 'Feature Demo', 'Live demonstration of key features', 420, 131072000, '1920x1080', 30.00, 4800000, 'product');
Step 3: Query All Videos
Retrieve all videos with formatted information.
SELECT
title,
description,
duration_seconds / 60 as duration_minutes,
file_size / 1048576 as size_mb,
resolution,
uploaded_by
FROM videos
ORDER BY created_at DESC;
Step 4: Filter by Duration
Find videos within a duration range.
SELECT
title,
duration_seconds,
resolution
FROM videos
WHERE duration_seconds BETWEEN 180 AND 400
ORDER BY duration_seconds;