A Next.js-based universal video downloader that supports multiple platforms including YouTube, TikTok, Instagram, Twitter, Facebook, Vimeo, and more.
See the app in action:
Screen.Recording.2025-09-13.at.8.43.20.PM.mp4
Watch how easy it is to download videos from any supported platform with just a URL paste!
- Instant URL detection - Just paste and go
- Video preview - See thumbnail and details before downloading
- Multiple formats - Choose quality and format
- Smart clipping - Download specific segments
This application uses a server-side processing architecture with Next.js API routes to handle video downloads securely without exposing sensitive operations to the client.
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Frontend β β API Routes β β External β
β (React) βββββΊβ (Next.js) βββββΊβ Tools β
β β β β β β
β β’ URL Input β β β’ video-info β β β’ yt-dlp β
β β’ Video Preview β β β’ download β β β’ ffmpeg β
β β’ Format Select β β β’ thumbnail β β β
β β’ Clip Settings β β β’ ffmpeg-check β β β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
- Next.js 14 - React framework with App Router
- TypeScript - Type safety and better DX
- Tailwind CSS - Utility-first styling
- Shadcn/UI - Component library
- Lucide React - Icon library
- Next.js API Routes - Server-side processing
- Node.js Child Process - External tool execution
- Stream Processing - Memory-efficient file handling
- yt-dlp - Video extraction engine
- ffmpeg - Video processing and clipping
Purpose: Extracts video metadata without downloading the actual video file.
Process Flow:
1. Client sends URL β API Route
2. API validates URL format
3. Executes: yt-dlp --dump-single-json [URL]
4. Parses JSON response
5. Returns formatted metadataKey Features:
- Platform detection (YouTube, TikTok, etc.)
- Thumbnail extraction
- Duration formatting
- File size estimation
- Format availability check
Command Example:
yt-dlp "https://youtube.com/watch?v=example" \
--dump-single-json \
--no-check-certificates \
--no-warnings \
--format best \
--geo-bypassPurpose: Downloads videos with optional clipping functionality.
Two Processing Modes:
yt-dlp -f [format] --no-warnings -o - [URL]- Streams directly to client
- Memory efficient
- Fastest option
# Step 1: Download to temp file
yt-dlp -f [format] -o /tmp/video.mp4 [URL]
# Step 2: Clip with ffmpeg
ffmpeg -i /tmp/video.mp4 -ss [start] -t [duration] -c copy /tmp/clip.mp4
# Step 3: Stream clipped file to clientClipping Logic:
- Time parsing:
mm:ssorhh:mm:ssβ seconds - Smart codec copying (no re-encoding when possible)
- Temporary file management
- Automatic cleanup
Purpose: Extracts and serves video thumbnails in multiple qualities.
Features:
- Multiple thumbnail qualities (maxres, high, medium, default)
- CORS proxy for thumbnail downloads
- Quality selection algorithm
- Fallback thumbnail generation
Process:
# Extract thumbnail list
yt-dlp --list-thumbnails [URL]
# Parse available qualities
# Select best quality based on preference
# Proxy download to avoid CORS issuesPurpose: Verifies ffmpeg availability for clipping functionality.
ffmpeg -version # Check if available- Node.js (v18 or higher)
- Python (v3.7 or higher)
- yt-dlp - Video extraction tool
- ffmpeg - Video processing (optional, for clipping)
npm install
# or
yarn install
# or
pnpm installOption A: Using pip (Recommended)
pip install yt-dlpOption B: Using pipx (Isolated)
pipx install yt-dlpOption C: Direct download
# Linux/macOS
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp
# Windows (PowerShell)
Invoke-WebRequest -Uri https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe -OutFile yt-dlp.exeUbuntu/Debian:
sudo apt update
sudo apt install ffmpegmacOS:
brew install ffmpegWindows:
# Using Chocolatey
choco install ffmpeg
# Using Scoop
scoop install ffmpegCentOS/RHEL:
sudo yum install epel-release
sudo yum install ffmpeg# Check yt-dlp
yt-dlp --version
# Check ffmpeg (optional)
ffmpeg -version
# Check Node.js
node --version# Development
npm run dev
# Production
npm run build
npm startWhen a user pastes a URL:
// Client sends URL to /api/video-info
const response = await fetch("/api/video-info", {
method: "POST",
body: JSON.stringify({ url }),
});
// Server executes yt-dlp
const command = `yt-dlp "${url}" --dump-single-json --no-warnings`;
const { stdout } = await execAsync(command);
const info = JSON.parse(stdout);
// Returns formatted metadata
return {
thumbnail: info.thumbnail,
title: info.title,
duration: formatDuration(info.duration),
platform: detectPlatform(url),
formats: info.formats,
};// Spawn yt-dlp process
const child = spawn("yt-dlp", [
"-f",
format,
"--no-warnings",
"-o",
"-", // Output to stdout
url,
]);
// Stream directly to client
child.stdout.on("data", (chunk) => {
// Forward chunk to HTTP response
});// Step 1: Download full video
await downloadToTemp(url, format, tempPath);
// Step 2: Process with ffmpeg
const ffmpegArgs = [
"-i",
tempPath,
"-ss",
startTime,
"-t",
duration,
"-c",
"copy", // No re-encoding
outputPath,
];
await execFFmpeg(ffmpegArgs);
// Step 3: Stream processed file
const buffer = await readFile(outputPath);
return new Response(buffer);The application supports these platforms through yt-dlp:
| Platform | URL Pattern | Special Features |
|---|---|---|
| YouTube | youtube.com, youtu.be |
Multiple qualities, live streams |
| TikTok | tiktok.com |
Mobile optimized |
instagram.com |
Stories, reels, posts | |
twitter.com, x.com |
Video tweets | |
facebook.com |
Public videos | |
| Vimeo | vimeo.com |
High quality options |
| Twitch | twitch.tv |
Clips and VODs |
reddit.com |
Video posts | |
| SoundCloud | soundcloud.com |
Audio extraction |
The application implements comprehensive error handling:
// Platform-specific errors
if (error.includes("Private video")) {
return "This video is private and cannot be downloaded";
}
if (error.includes("geo-blocked")) {
return "Content is geo-blocked or restricted";
}
// System errors
if (error.code === "ENOENT") {
return "yt-dlp not found in PATH";
}- Server Environment: Linux/macOS/Windows with Node.js
- Python Environment: Python 3.7+ with pip
- System Tools: yt-dlp and optionally ffmpeg in PATH
- Memory: Sufficient for temporary file storage during clipping
- Disk Space: Temporary storage for video processing
FROM node:18-alpine
# Install Python and pip
RUN apk add --no-cache python3 py3-pip ffmpeg
# Install yt-dlp
RUN pip3 install yt-dlp
# Copy and install app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]- Streaming: Direct streaming for non-clipped downloads
- Temporary Files: Automatic cleanup of processed files
- Memory Management: Buffer size limits for large files
- Timeout Handling: Request timeouts for slow platforms
- Concurrent Limits: Process spawning limits
- Input Validation: URL format validation
- Command Injection: Proper argument escaping
- File System: Temporary file isolation
- Resource Limits: Memory and timeout constraints
- User Agent: Proper headers to avoid blocking
1. "yt-dlp not found"
# Check if yt-dlp is in PATH
which yt-dlp
yt-dlp --version
# Install if missing
pip install yt-dlp2. "ffmpeg not available"
# Check ffmpeg installation
which ffmpeg
ffmpeg -version
# Install if missing (Ubuntu)
sudo apt install ffmpeg3. "Download failed"
- Check internet connectivity
- Verify URL is accessible
- Check if video is private/geo-blocked
- Update yt-dlp:
pip install -U yt-dlp
4. "Clipping not working"
- Ensure ffmpeg is installed
- Check temporary directory permissions
- Verify sufficient disk space
Enable detailed logging:
# Set environment variable
DEBUG=1 npm run dev
# Check API logs in browser network tab
# Check server logs in terminal- Direct Download: ~5-10MB/s (network dependent)
- Clipped Download: ~2-5MB/s (processing overhead)
- Memory Usage: ~50-200MB per concurrent download
- Disk Usage: Temporary files during clipping only
# Update yt-dlp regularly for platform compatibility
pip install -U yt-dlp- Monitor yt-dlp releases for platform fixes
- Test major platforms regularly
- Update error handling for new edge cases
This project is for educational purposes. Respect platform terms of service and copyright laws when downloading content.