






INSERT INTO video_formats (name, postfix, width, height, keep_aspect, ffmpeg_options, is_active, is_source, sort_order)
SELECT 'MP4 4K (2160p)', '_2160p.mp4', 3840, 2160, 1, '-c:v libx264 -profile:v high -level:v 5.2 -preset medium -crf 20 -maxrate 24000k -bufsize 48000k -pix_fmt yuv420p -c:a aac -ar 48000 -b:a 192k -movflags +faststart -f mp4', 1, 0, 1
WHERE NOT EXISTS (SELECT 1 FROM video_formats WHERE postfix = '_2160p.mp4');
UPDATE video_formats SET name='MP4 4K (2160p)', width=3840, height=2160, keep_aspect=1, ffmpeg_options='-c:v libx264 -profile:v high -level:v 5.2 -preset medium -crf 20 -maxrate 24000k -bufsize 48000k -pix_fmt yuv420p -c:a aac -ar 48000 -b:a 192k -movflags +faststart -f mp4', is_active=1, sort_order=1 WHERE postfix='_2160p.mp4';


INSERT INTO video_formats (name, postfix, width, height, keep_aspect, ffmpeg_options, is_active, is_source, sort_order)
SELECT 'MP4 2K (1440p)', '_1440p.mp4', 2560, 1440, 1, '-c:v libx264 -profile:v high -level:v 5.1 -preset medium -crf 20 -maxrate 14000k -bufsize 28000k -pix_fmt yuv420p -c:a aac -ar 48000 -b:a 192k -movflags +faststart -f mp4', 1, 0, 2
WHERE NOT EXISTS (SELECT 1 FROM video_formats WHERE postfix = '_1440p.mp4');
UPDATE video_formats SET name='MP4 2K (1440p)', width=2560, height=1440, keep_aspect=1, ffmpeg_options='-c:v libx264 -profile:v high -level:v 5.1 -preset medium -crf 20 -maxrate 14000k -bufsize 28000k -pix_fmt yuv420p -c:a aac -ar 48000 -b:a 192k -movflags +faststart -f mp4', is_active=1, sort_order=2 WHERE postfix='_1440p.mp4';


INSERT INTO video_formats (name, postfix, width, height, keep_aspect, ffmpeg_options, is_active, is_source, sort_order)
SELECT 'MP4 1080p', '_1080p.mp4', 1920, 1080, 1, '-c:v libx264 -profile:v high -level:v 4.2 -preset medium -crf 21 -maxrate 6000k -bufsize 12000k -pix_fmt yuv420p -c:a aac -ar 44100 -b:a 192k -movflags +faststart -f mp4', 1, 0, 3
WHERE NOT EXISTS (SELECT 1 FROM video_formats WHERE postfix = '_1080p.mp4');
UPDATE video_formats SET name='MP4 1080p', width=1920, height=1080, keep_aspect=1, ffmpeg_options='-c:v libx264 -profile:v high -level:v 4.2 -preset medium -crf 21 -maxrate 6000k -bufsize 12000k -pix_fmt yuv420p -c:a aac -ar 44100 -b:a 192k -movflags +faststart -f mp4', is_active=1, sort_order=3 WHERE postfix='_1080p.mp4';


INSERT INTO video_formats (name, postfix, width, height, keep_aspect, ffmpeg_options, is_active, is_source, sort_order)
SELECT 'MP4 720p', '_720p.mp4', 1280, 720, 1, '-c:v libx264 -profile:v high -level:v 4.0 -preset medium -crf 22 -maxrate 4500k -bufsize 9000k -pix_fmt yuv420p -c:a aac -ar 44100 -b:a 128k -movflags +faststart -f mp4', 1, 0, 4
WHERE NOT EXISTS (SELECT 1 FROM video_formats WHERE postfix = '_720p.mp4');
UPDATE video_formats SET name='MP4 720p', width=1280, height=720, keep_aspect=1, ffmpeg_options='-c:v libx264 -profile:v high -level:v 4.0 -preset medium -crf 22 -maxrate 4500k -bufsize 9000k -pix_fmt yuv420p -c:a aac -ar 44100 -b:a 128k -movflags +faststart -f mp4', is_active=1, sort_order=4 WHERE postfix='_720p.mp4';


INSERT INTO video_formats (name, postfix, width, height, keep_aspect, ffmpeg_options, is_active, is_source, sort_order)
SELECT 'MP4 480p', '_480p.mp4', 854, 480, 1, '-c:v libx264 -profile:v high -level:v 3.1 -preset medium -crf 23 -maxrate 2100k -bufsize 4200k -pix_fmt yuv420p -c:a aac -ar 44100 -b:a 128k -movflags +faststart -f mp4', 1, 0, 5
WHERE NOT EXISTS (SELECT 1 FROM video_formats WHERE postfix = '_480p.mp4');
UPDATE video_formats SET name='MP4 480p', width=854, height=480, keep_aspect=1, ffmpeg_options='-c:v libx264 -profile:v high -level:v 3.1 -preset medium -crf 23 -maxrate 2100k -bufsize 4200k -pix_fmt yuv420p -c:a aac -ar 44100 -b:a 128k -movflags +faststart -f mp4', is_active=1, sort_order=5 WHERE postfix='_480p.mp4';


INSERT INTO video_formats (name, postfix, width, height, keep_aspect, ffmpeg_options, is_active, is_source, sort_order)
SELECT 'MP4 360p', '_360p.mp4', 640, 360, 1, '-c:v libx264 -profile:v high -level:v 3.1 -preset medium -crf 24 -maxrate 1200k -bufsize 2400k -pix_fmt yuv420p -c:a aac -ar 44100 -b:a 96k -movflags +faststart -f mp4', 1, 0, 6
WHERE NOT EXISTS (SELECT 1 FROM video_formats WHERE postfix = '_360p.mp4');
UPDATE video_formats SET name='MP4 360p', width=640, height=360, keep_aspect=1, ffmpeg_options='-c:v libx264 -profile:v high -level:v 3.1 -preset medium -crf 24 -maxrate 1200k -bufsize 2400k -pix_fmt yuv420p -c:a aac -ar 44100 -b:a 96k -movflags +faststart -f mp4', is_active=1, sort_order=6 WHERE postfix='_360p.mp4';
