Nousverse LLP Logo
// ArchitectureAugust 6, 20265 min read
// Share

Optimizing Heavy Media for Lightning-Fast Web Delivery on Vercel

How we resolved deployment size ceilings on Vercel and cut media loading times by 98% for cinematic layouts without sacrificing visual quality.

Optimizing Heavy Media for Lightning-Fast Web Delivery on Vercel

When designing modern cinematic web layouts, video backgrounds play a crucial role in creating an immersive, premium user experience. However, rich media assets often introduce two major bottlenecks: hosting provider limitations and client-side bandwidth congestion.

This article details a real-world case study of how we optimized a media-heavy application, resolving Vercel deployment limits and cutting media loading times by 98% without sacrificing visual quality.


1. The Challenge: Vercel Limits & Ignored Folders

During a recent deployment on Vercel, we encountered two immediate blockers:

  • The Silent Skip: Local video assets placed inside public/videos/ were not rendering on the live site, falling back to the single-page application's root template.
  • The Hard Ceiling: After resolving the folder mapping, Vercel aborted the deployment pipeline with a fatal error: Error: File size limit exceeded (100 MB).

Root Cause Analysis

Case-Insensitive Folder Ignores: Vercel CLI utilizes .gitignore and .vercelignore matching specifications. A root pattern of Videos/ (intended to ignore raw project video dumps) was case-insensitively matching public/videos/ on macOS, silently ignoring the web assets folder.

Raw Media Bloat: The primary background video asset for the main ecosystem page was a raw drone clip weighing in at 518.5 MB. Vercel enforces a strict 100 MB per-file limit on static assets, triggering a hard abort.


2. Technical Auditing with ffprobe

To determine why a 37-second drone clip was over half a gigabyte, we audited the container metadata using ffprobe:

ffprobe -v error -show_format -show_streams public/videos/video_primary.mp4

The Raw Metadata Profile

  • Duration: 37.7 seconds
  • Resolution: 3840x2160 (Ultra HD / 4K)
  • Frame Rate: 60 fps
  • Video Bitrate: 110 Mbps

While a 110 Mbps bitrate and 4K resolution at 60 fps are ideal for editing suites, they are highly counterproductive for web delivery. A user visiting the site on a mobile connection or standard laptop would experience severe lag, stuttering, and massive data consumption just to render a background loop.


3. The Solution: Web-Optimized Transcoding

Using ffmpeg, we transcoded the video assets into a format optimized for web rendering. Our target constraints were:

  • Resolution: Downscaled from 4K to 1080p (1920x1080).
  • Frame Rate: Reduced from 60 fps to 30 fps (perfectly smooth for background ambient loops).
  • Audio: Stripped entirely (-an) to shave off container bytes.
  • Codec & Bitrate: Compressed using standard H.264 (libx264) with a Constant Rate Factor (CRF) of 26 for an optimal balance between visual clarity and stream efficiency.

Transcoding Commands

For the 518 MB primary background video:

ffmpeg -i public/videos/video_primary.mp4 \
  -vf "scale=1920:-2" \
  -r 30 \
  -c:v libx264 \
  -crf 26 \
  -preset fast \
  -an \
  public/videos/video_primary_temp.mp4 && \
  mv public/videos/video_primary_temp.mp4 public/videos/video_primary.mp4

For the 58 MB secondary background video:

ffmpeg -i public/videos/video_secondary.mp4 \
  -vf "scale=1920:-2" \
  -r 30 \
  -c:v libx264 \
  -crf 26 \
  -preset fast \
  -an \
  public/videos/video_secondary_temp.mp4 && \
  mv public/videos/video_secondary_temp.mp4 public/videos/video_secondary.mp4

4. The Results

The optimization metrics show a massive difference in asset sizing and loading performance:

Asset Name Original Size Compressed Size Size Reduction Target Bitrate Status
video_primary.mp4 518.5 MB 10.7 MB 97.9% ~2.3 Mbps Fully Live
video_secondary.mp4 58.8 MB 14.3 MB 75.6% ~5.3 Mbps Fully Live

Key Improvements:

  • Vercel Compatibility: The payload dropped way below the 100 MB threshold, allowing instant, error-free builds.
  • Core Web Vitals Boost: The Largest Contentful Paint (LCP) and page load times improved dramatically since browsers now fetch a ~10 MB streamable segment rather than buffering a 500 MB file.
  • Strict Pattern Matching: We updated .vercelignore to anchor raw project directories using a leading slash (e.g. /Videos/), ensuring subfolders like public/videos/ are correctly uploaded.
# Correctly configured .vercelignore
/Raw_Source_Videos/
/Videos/
/temp_assets/
.git/
node_modules/
dist/
*.mov

5. Conclusion

Deploying cinematic websites with looping video backgrounds does not require sacrificing page speed or hitting cloud hosting boundaries. By using tools like ffmpeg to target web-optimized resolutions (1080p), lower bitrates (~2-5 Mbps), and removing audio channels, we can achieve high-quality visual results with minimal bandwidth impact.

// Share

Comments(0)

// Leave a comment

No comments yet. Be the first to share your thoughts.

Chat with Us