56fe68eb48
- Royal cream + gold theme - Playful animated hero with chef mascot - Advanced menu with sidebar + video hover - Multilingual support (EN, SV, HI, UR) - Cart system with WhatsApp ordering - Real restaurant photos integration - Responsive design with proper navbar
81 lines
2.4 KiB
Bash
Executable File
81 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# ============================================================
|
|
# Advanced Video Optimization Script for Shahi Kitchen
|
|
# Optimized for realistic food videos (short loops)
|
|
# ============================================================
|
|
#
|
|
# Target per video:
|
|
# - Duration: 4-5 seconds
|
|
# - Resolution: 480p (854x480)
|
|
# - WebM (VP9): 500-800 KB
|
|
# - MP4 fallback: 700-1100 KB
|
|
#
|
|
# Usage:
|
|
# cd /home/khan/code/shahikitchen/public/videos
|
|
# bash /home/khan/code/shahikitchen/optimize-food-videos.sh
|
|
#
|
|
# Requirements: ffmpeg with libvpx-vp9 and libx264
|
|
# ============================================================
|
|
|
|
set -e
|
|
|
|
echo "=== Shahi Kitchen Food Video Optimizer ==="
|
|
echo "Creating heavily optimized WebM + MP4 versions..."
|
|
echo "Original .mp4 files will NOT be deleted."
|
|
echo ""
|
|
|
|
for file in *.mp4; do
|
|
if [ ! -f "$file" ]; then
|
|
continue
|
|
fi
|
|
|
|
base="${file%.mp4}"
|
|
|
|
# Skip if already optimized
|
|
if [ -f "${base}-optimized.webm" ]; then
|
|
echo "→ Skipping $file (already optimized)"
|
|
continue
|
|
fi
|
|
|
|
echo "→ Optimizing: $file"
|
|
|
|
# === WebM (VP9) - Primary (Best size/quality) ===
|
|
# === WebM (VP9) - Primary (Best size/quality for realistic food videos) ===
|
|
# 2-pass for best quality at low bitrate
|
|
ffmpeg -y -i "$file" \
|
|
-c:v libvpx-vp9 -b:v 550k -crf 35 -deadline good -cpu-used 4 \
|
|
-vf "scale=854:480,unsharp=5:5:0.5:5:5:0.0" \
|
|
-an \
|
|
-r 24 \
|
|
-pass 1 -f null /dev/null 2>/dev/null
|
|
|
|
ffmpeg -y -i "$file" \
|
|
-c:v libvpx-vp9 -b:v 550k -crf 35 -deadline good -cpu-used 4 \
|
|
-vf "scale=854:480,unsharp=5:5:0.5:5:5:0.0" \
|
|
-an \
|
|
-r 24 \
|
|
-pass 2 \
|
|
"${base}-optimized.webm" 2>/dev/null
|
|
|
|
# === MP4 Fallback (H.264) - Good compatibility ===
|
|
ffmpeg -y -i "$file" \
|
|
-c:v libx264 -b:v 750k -crf 28 -preset slow \
|
|
-vf "scale=854:480" \
|
|
-c:a aac -b:a 48k \
|
|
-r 24 \
|
|
-movflags +faststart \
|
|
"${base}-optimized.mp4" 2>/dev/null
|
|
|
|
echo " Created: ${base}-optimized.webm + ${base}-optimized.mp4"
|
|
done
|
|
|
|
echo ""
|
|
echo "✅ All videos optimized!"
|
|
echo ""
|
|
echo "Recommended next steps:"
|
|
echo "1. Test a few -optimized.webm files in browser"
|
|
echo "2. Update menu data to point to the new optimized files (optional)"
|
|
echo "3. When happy, you can replace the old files or keep both versions"
|
|
echo ""
|
|
echo "Tip: WebM files are usually 30-50% smaller than MP4 at similar quality." |