Skip to content

kaif11ali/GIF-converter

Β 
Β 

Repository files navigation

AIO Convert - All-in-One Media Converter

Created by Salimuddin - Full-Stack Developer & Media Processing Expert

A comprehensive, modern media conversion platform built with Node.js and React. Features professional-grade architecture with properly named services and clean code structure.

πŸš€ Features

Image Processing

  • Format Conversion: JPEG, PNG, WebP, AVIF, GIF, BMP, TIFF, SVG
  • Image Manipulation: Resize, crop, rotate, optimize, apply effects
  • Intelligent Service Selection: Automatically chooses optimal processing library (Sharp, Jimp, ImageMagick)
  • Batch Processing: Convert multiple files simultaneously
  • Advanced Effects: Filters, overlays, watermarks, text addition

Video Processing

  • Format Conversion: MP4, AVI, MOV, WebM, MKV, M4V, 3GP, FLV
  • Video Manipulation: Split, merge, resize, quality adjustment
  • Scene Detection: Intelligent video segmentation
  • Frame Extraction: Extract specific frames or sequences
  • Web Optimization: Multiple quality presets for web delivery

GIF Processing

  • GIF Creation: Convert videos/images to animated GIFs
  • Frame Manipulation: Extract, edit, and reassemble GIF frames
  • Optimization: Size and quality optimization for web
  • Scene Filtering: Smart frame selection based on content analysis
  • Text Overlay: Add animated text to GIFs

Modern Architecture

  • Consolidated Services: Replaced 20+ duplicate services with 3 unified processors
  • Intelligent Service Selection: Automatic optimal library selection based on operation and file characteristics
  • Event-Driven Processing: Real-time progress tracking and status updates
  • Clean API Design: RESTful endpoints with comprehensive error handling
  • Factory Pattern: Centralized service management and configuration

πŸ“ Project Structure

πŸ“¦ GIF converter/
β”œβ”€β”€ πŸ“‚ backend/                 # Node.js Express API
β”‚   β”œβ”€β”€ πŸ“‚ src/
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ controllers/     # Request handlers
β”‚   β”‚   β”‚   └── πŸ“„ webpController.js         # WebP-specific operations
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ routes/          # API route definitions (NEW PROPER NAMING!)
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ConversionRoutes.js       # Main conversion endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ SplitRoutes.js           # Video/GIF splitting operations
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ VideoRoutes.js           # Video processing endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ AiRoutes.js              # AI-powered enhancements
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ TextRoutes.js            # Text processing operations
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ FileRoutes.js            # File management endpoints
β”‚   β”‚   β”‚   └── πŸ“„ WebpRoutes.js            # WebP conversion routes
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ services/        # Core processing services (COMPLETELY REFACTORED!)
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ImageProcessingService.js # Unified image processing
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ VideoProcessingService.js # Unified video processing  
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ GifProcessingService.js   # Unified GIF processing
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ AiService.js              # AI-powered enhancements
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ CleanupService.js         # File cleanup management
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ConversionService.js      # General conversion utilities
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ EditService.js            # Image editing operations
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ FfmpegService.js          # FFmpeg wrapper service
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ GifService.js             # Advanced GIF operations
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ SplitService.js           # Media splitting utilities
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ TextService.js            # Text overlay processing
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ VideoService.js           # Video manipulation tools
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ WebPService.js            # WebP format handling
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ SharpService.js           # Sharp image processing
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ JimpService.js            # Pure JS image processing
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ImageMagickService.js     # ImageMagick integration
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ EnhancedConversionService.js # Advanced conversions
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ EnhancedJimpService.js    # Extended Jimp functionality
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ MediaAnalysisService.js   # Media analysis tools
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ CanvasGraphicsService.js  # Canvas-based graphics
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ VideoJSService.js         # Video.js integration
β”‚   β”‚   β”‚   β”œβ”€β”€ οΏ½ VideoSplitterService.js   # Video splitting utilities
β”‚   β”‚   β”‚   └── πŸ“„ index.js                  # ServiceFactory & Registry
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ utils/           # Utility libraries (RENAMED FROM lib/)
β”‚   β”‚   β”‚   └── πŸ“„ FilePathUtils.js          # Centralized file management
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ middleware/      # Express middleware (PROPER NAMING!)
β”‚   β”‚   β”‚   β”œβ”€β”€ οΏ½ ErrorHandler.js           # Error handling middleware
β”‚   β”‚   β”‚   └── πŸ“„ FileValidator.js          # File validation middleware
β”‚   β”‚   β”œβ”€β”€ οΏ½πŸ“‚ config/          # Configuration files
β”‚   β”‚   β”‚   └── πŸ“„ index.js                  # Main configuration
β”‚   β”‚   β”œβ”€β”€ πŸ“„ app.js           # Express application setup
β”‚   β”‚   └── πŸ“„ server.js        # Server entry point
β”‚   β”œβ”€β”€ πŸ“„ package.json
β”‚   └── πŸ“„ eslint.config.js
β”œβ”€β”€ πŸ“‚ frontend/                # React SPA
β”‚   β”œβ”€β”€ πŸ“‚ src/
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ components/      # React components (RENAMED & ORGANIZED!)
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ MainConversionInterface.jsx   # Main conversion UI
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ProgressVisualization.jsx     # Progress tracking
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ MainNavigation.jsx            # Navigation component
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ImageEditor.jsx               # Image editing interface
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ FileManager.jsx               # File management UI
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ VideoToGifConverter.jsx       # Video to GIF converter
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ WebPConverter.jsx             # WebP conversion UI
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ GifSplitter.jsx               # GIF splitting interface
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ AddText.jsx                   # Text overlay component
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ AdvancedUploadArea.jsx        # Advanced file upload
β”‚   β”‚   β”‚   β”œβ”€β”€ οΏ½ Footer.jsx                    # Footer component
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ Header.jsx                    # Header component
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ HomePage.jsx                  # Home page component
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ Results.jsx                   # Results display
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ Sidebar.jsx                   # Sidebar navigation
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ SplitResults.jsx              # Split results display
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ UploadArea.jsx                # File upload area
β”‚   β”‚   β”‚   └── πŸ“„ VideoResults.jsx              # Video results display
β”‚   β”‚   β”œβ”€β”€ οΏ½πŸ“‚ utils/           # Frontend utilities
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ NotificationService.js        # Notification system
β”‚   β”‚   β”‚   └── πŸ“„ polishedHelpers.js           # UI helper functions
β”‚   β”‚   β”œβ”€β”€ πŸ“„ App.jsx          # Main application component
β”‚   β”‚   β”œβ”€β”€ πŸ“„ main.jsx         # React entry point
β”‚   β”‚   └── πŸ“„ aio-convert-style.css # Main stylesheet
β”‚   β”œβ”€β”€ πŸ“„ package.json
β”‚   β”œβ”€β”€ πŸ“„ vite.config.js
β”‚   └── πŸ“„ index.html
β”œβ”€β”€ πŸ“‚ logs/                    # Application logs
β”œβ”€β”€ πŸ“‚ output/                  # Processed file output
β”œβ”€β”€ πŸ“‚ public/                  # Static assets
β”‚   └── πŸ“‚ static/
β”œβ”€β”€ πŸ“‚ temp/                    # Temporary processing files
β”œβ”€β”€ πŸ“‚ uploads/                 # Uploaded files
β”œβ”€β”€ πŸ“„ README.md                # This file
β”œβ”€β”€ πŸ“„ ARCHITECTURE.md          # Detailed architecture documentation
└── πŸ“„ package.json             # Root package configuration

πŸ› οΈ Installation & Setup

Prerequisites

  • Node.js 18+ and npm
  • FFmpeg (for video processing)
  • ImageMagick (for advanced image operations)

Backend Setup

cd backend
npm install
npm run dev    # Development server with hot reload
npm start      # Production server

Frontend Setup

cd frontend
npm install
npm run dev    # Development server with hot reload
npm run build  # Production build

Environment Configuration

Create .env files in both backend and frontend directories:

Backend .env:

NODE_ENV=development
PORT=3001
OPENAI_API_KEY=your_openai_key_here
MAX_FILE_SIZE_MB=500
MAX_BATCH_COUNT=20

Frontend .env:

VITE_API_BASE_URL=http://localhost:3001
VITE_MAX_FILE_SIZE=500

πŸ”§ Core Services Architecture

Modern Service Organization

This project features a completely refactored service architecture with proper naming conventions:

ImageProcessingService.js

The consolidated image processing service that intelligently selects the optimal library:

import { imageProcessor } from './services/index.js';

// Automatic optimal library selection
const result = await imageProcessor.convertImage('input.jpg', {
  format: 'webp',
  quality: 85,
  width: 1200
});

// Batch processing with concurrency control  
const results = await imageProcessor.batchConvert(files, {
  format: 'webp',
  concurrent: 4
});

VideoProcessingService.js

Event-driven video processing with progress tracking:

import { videoProcessor } from './services/index.js';

// Set up event listeners
videoProcessor.on('progress', (progress) => {
  console.log(`Processing: ${progress.percent}%`);
});

// Convert with quality presets
const result = await videoProcessor.convertVideo('input.mp4', {
  format: 'webm',
  quality: 'high',
  width: 1920,
  height: 1080
});

GifProcessingService.js

Advanced GIF creation with scene detection:

import { gifProcessor } from './services/index.js';

// Create optimized GIF from video  
const result = await gifProcessor.createFromVideo('input.mp4', {
  fps: 15,
  width: 500,
  duration: 10,
  sceneDetection: true
});

// Extract frames with filtering
const frames = await gifProcessor.extractFrames('input.gif', {
  sceneThreshold: 0.3,
  maxFrames: 50
});

ServiceFactory Pattern

Centralized service management with intelligent selection:

import { serviceFactory } from './services/index.js';

// Get optimal service for file type and operation
const service = serviceFactory.getServiceFor('.mp4', 'convert');
const result = await service.convertVideo(inputPath, options);

// Get services by capability
const videoServices = serviceFactory.getServicesByCategory('video');

🎯 API Endpoints

Image Operations

  • POST /api/convert - Convert image formats (via ConversionRoutes.js)
  • POST /api/convert/batch - Batch image conversion
  • POST /api/convert/gif-editor - Advanced GIF editing
  • POST /api/convert/validate - Validate conversion options

Video Operations

  • POST /api/video/convert - Convert video formats (via VideoRoutes.js)
  • POST /api/split/video - Split videos into segments (via SplitRoutes.js)
  • GET /api/split/video/status/:jobId - Get video processing status
  • GET /api/split/video/download/:jobId - Download processed video segments

GIF Operations

  • POST /api/convert/gif-advanced - Advanced GIF processing
  • POST /api/split/gif - Extract frames from GIF (via SplitRoutes.js)
  • GET /api/split/gif/status/:jobId - Get GIF processing status
  • GET /api/split/gif/download-zip/:jobId - Download extracted frames

WebP Operations

  • POST /api/webp/convert - WebP conversion (via WebpRoutes.js)
  • POST /api/webp/batch - Batch WebP processing

Text & AI Operations

  • POST /api/text/overlay - Add text overlays (via TextRoutes.js)
  • POST /api/ai/enhance - AI-powered enhancements (via AiRoutes.js)

File Management

  • GET /api/files/:filename - Download processed files (via FileRoutes.js)
  • GET /api/files/list - List available files
  • DELETE /api/files/cleanup - Clean up temporary files
  • GET /api/files/download/:id - Download processed files
  • DELETE /api/files/cleanup - Clean up temporary files

πŸ§ͺ Development

Code Quality

# Backend linting
cd backend
npm run lint        # Check code style
npm run lint:fix    # Auto-fix style issues

# Frontend linting  
cd frontend
npm run lint        # Check code style
npm run lint:fix    # Auto-fix style issues

Project Standards

  • ES Modules: All code uses modern ES module syntax
  • Async/Await: Promise-based asynchronous operations
  • Error Handling: Comprehensive error catching and user-friendly messages
  • Documentation: JSDoc comments for all public functions
  • Type Safety: Runtime type checking and validation
  • Security: Input validation, file type restrictions, path traversal protection

Service Factory Pattern

The project uses a centralized ServiceFactory for intelligent service selection:

import { serviceFactory } from './services/index.js';

// Get optimal service for file type and operation
const service = serviceFactory.getServiceFor('.mp4', 'convert');
const result = await service.convertVideo(inputPath, options);

// Get services by capability
const videoServices = serviceFactory.getServicesByCategory('video');

πŸš€ Deployment

⚠️ Important: Vercel Limitations

Vercel CANNOT host the backend due to:

  • No persistent file storage
  • Serverless function limitations
  • Heavy binary dependencies (FFmpeg, ImageMagick)
  • Large file processing requirements

βœ… Recommended Deployment Strategy

Frontend β†’ Vercel (Perfect Match!)

# Deploy frontend to Vercel
cd frontend
npm run build
# Connect to Vercel dashboard or use Vercel CLI
vercel --prod

Backend β†’ Railway/Render/DigitalOcean

Option A: Railway (Recommended)

  1. Connect your GitHub repo to Railway
  2. Railway will automatically detect the Dockerfile
  3. Set environment variables in Railway dashboard
  4. Deploy backend with Docker support

Option B: Render

  1. Connect GitHub repo to Render
  2. Use the included render.yaml configuration
  3. Render will build and deploy automatically

Option C: DigitalOcean App Platform

# Use the Dockerfile for container deployment
# Set up environment variables in DO dashboard

Environment Configuration

Frontend Environment (.env for Vercel)

VITE_API_BASE_URL=https://your-backend-url.railway.app
VITE_MAX_FILE_SIZE=500

Backend Environment (Railway/Render)

NODE_ENV=production
PORT=8080
MAX_FILE_SIZE_MB=500
MAX_BATCH_COUNT=20
OPENAI_API_KEY=your_openai_key_here
CORS_ORIGIN=https://your-frontend-url.vercel.app

Deployment Steps

  1. Deploy Backend First:

    • Push code to GitHub
    • Connect to Railway/Render
    • Set environment variables
    • Get backend URL
  2. Deploy Frontend:

    • Update VITE_API_BASE_URL with backend URL
    • Deploy to Vercel
    • Update CORS_ORIGIN in backend with frontend URL
  3. Test Connection:

    • Verify API endpoints work
    • Test file uploads/downloads
    • Check CORS configuration

🀝 Contributing

  1. Code Style: Follow the ESLint configuration
  2. Documentation: Add JSDoc comments for new functions
  3. Testing: Test all new features thoroughly
  4. Service Integration: Use the ServiceFactory pattern for new services
  5. Error Handling: Implement comprehensive error handling

πŸ“‹ Recent Major Refactoring βœ…

This project underwent a comprehensive refactoring with professional naming conventions:

βœ… File Structure Improvements

  • Services Renamed: All services now use proper PascalCase with descriptive suffixes

    • image-processor.js β†’ ImageProcessingService.js
    • video-processor.js β†’ VideoProcessingService.js
    • gif-processor.js β†’ GifProcessingService.js
    • aiService.js β†’ AiService.js
    • cleanupService.js β†’ CleanupService.js
    • And 15+ more services properly renamed
  • Routes Renamed: All route files now clearly indicate their purpose

    • convert.js β†’ ConversionRoutes.js
    • split.js β†’ SplitRoutes.js
    • video.js β†’ VideoRoutes.js
    • ai.js β†’ AiRoutes.js
    • text.js β†’ TextRoutes.js
    • files.js β†’ FileRoutes.js
    • webp.js β†’ WebpRoutes.js
  • Utilities Reorganized: Better structure and naming

    • lib/ directory β†’ utils/ directory
    • file-paths.js β†’ FilePathUtils.js
    • errorHandler.js β†’ ErrorHandler.js
    • validateFiles.js β†’ FileValidator.js
  • Frontend Components: React components now have clear, descriptive names

    • AIOConvertMainInterface.jsx β†’ MainConversionInterface.jsx
    • D3ProgressVisualization.jsx β†’ ProgressVisualization.jsx
    • FullPageNavigation.jsx β†’ MainNavigation.jsx
    • KonvaImageEditor.jsx β†’ ImageEditor.jsx
    • SortableFileManager.jsx β†’ FileManager.jsx
    • VideoToGif.jsx β†’ VideoToGifConverter.jsx

βœ… Import System Overhaul

  • All Import Statements Updated: Every import throughout the entire codebase has been updated
  • Path Consistency: All utilities now use consistent ../utils/FilePathUtils.js paths
  • Service References: All service imports use the new proper names
  • Component References: All React component imports and function names updated

βœ… Code Quality Improvements

  • Professional Naming: All files now follow industry-standard naming conventions
  • Better Organization: Clear separation of concerns with descriptive file names
  • Improved Maintainability: Much easier to locate and understand code purpose
  • Enhanced Readability: Self-documenting file names that explain functionality

πŸ”§ Technical Benefits Achieved

  • Service Consolidation: Unified processors replace 20+ duplicate services
  • Architecture Modernization: ServiceFactory pattern and WorkflowOrchestrator implemented
  • Documentation: Comprehensive inline documentation added
  • Error Handling: Improved consistency across all services
  • Modularity: Clean separation between services, routes, and utilities

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ”— Related Documentation


Built with ❀️ for modern media processing needs

  • Automatic scene-based splitting using AI detection
  • Progress tracking for long operations
  • Batch download of all segments as ZIP
  • GIF Frame Extraction:
    • Extract all frames from animated GIFs
    • Scene-based frame extraction with similarity detection
    • Multiple output formats (PNG, JPG, WebP)
    • Duplicate frame filtering
    • Batch frame downloads

πŸ› οΈ Advanced Features

  • Real-time Progress Tracking: Monitor conversion progress with detailed status updates
  • Job Management: Queue multiple operations with unique job IDs
  • Automatic Cleanup: Smart temporary file management
  • API-First Design: RESTful API with comprehensive endpoints
  • Error Handling: Robust error handling with detailed feedback
  • Mobile Responsive: Works seamlessly across all devices

πŸ—οΈ Tech Stack

Backend

  • Runtime: Node.js 18+ with Express.js
  • Media Processing:
    • FFmpeg with fluent-ffmpeg for video operations
    • Sharp for image processing
    • ImageMagick integration for advanced operations
  • File Handling: Multer for uploads, Archiver for ZIP creation
  • Architecture: EventEmitter-based services for scalable processing
  • API: RESTful design with comprehensive error handling

Frontend

  • Framework: React 18 with modern hooks
  • Build Tool: Vite for fast development and optimized builds
  • Styling: Modern CSS with responsive design
  • UI/UX: Professional interface with progress indicators
  • Notifications: Smart notification system for user feedback

Development & Testing

  • Testing: Jest + Supertest for comprehensive API testing
  • Development: Hot reload with Vite dev server
  • Code Quality: ESLint configuration for consistent code style
  • Environment: Configurable environment variables

πŸ“‹ Prerequisites

  • Node.js: Version 18.0.0 or higher
  • FFmpeg: Required for video processing (automatically handled by ffmpeg-static)
  • RAM: Minimum 4GB recommended for large media files
  • Storage: Adequate space for temporary file processing

⚑ Quick Start

1. Clone Repository

git clone https://github.com/salimuddin93/gif-converter.git
cd gif-converter

2. Install Dependencies

# Install backend dependencies
cd backend
npm install

# Install frontend dependencies
cd ../frontend
npm install

3. Start Development Servers

Backend Server:

cd backend
npm run dev

Server runs on http://localhost:4000

Frontend Server:

cd frontend
npm run dev

Frontend runs on http://localhost:5173

4. Access Application

Open http://localhost:5173 in your browser to start using AIO Convert!

πŸ”§ Configuration

Environment Variables

Create a .env file in the backend directory:

# Server Configuration
PORT=4000
NODE_ENV=development

# File Processing
MAX_FILE_SIZE_MB=500
MAX_BATCH_COUNT=50
TEMP_DIR=./temp
OUTPUT_DIR=./output

# Cleanup Settings
FILE_TTL_MINUTES=60
CLEANUP_INTERVAL_CRON="*/30 * * * *"

# Image Quality
JPEG_QUALITY=85
PNG_COMPRESSION=6
WEBP_QUALITY=80

# Video Processing
FFMPEG_TIMEOUT=300000
VIDEO_QUALITY_PRESET=medium

πŸ“‘ API Documentation

Image Conversion

Convert Images

POST /api/convert
Content-Type: multipart/form-data

files: <image files>
targetFormat: png|jpg|jpeg|gif|webp|bmp
quality: 1-100 (optional)
singleGif: true|false (optional)
gif.frameDelay: <milliseconds> (optional)
gif.loop: <number> (optional, 0 = infinite)

Response:

{
  "results": [
    {
      "originalName": "image1.png",
      "convertedName": "converted_1234567890.jpg",
      "url": "/api/files/converted_1234567890.jpg",
      "sizeBytes": 245760,
      "mimeType": "image/jpeg",
      "dimensions": { "width": 1920, "height": 1080 }
    }
  ]
}

Video Processing

Convert Video to GIF

POST /api/video/to-gif
Content-Type: multipart/form-data

video: <video file>
startTime: <seconds> (optional)
endTime: <seconds> (optional)
fps: <frames per second> (optional)
quality: low|medium|high|custom (optional)
width: <pixels> (optional)
height: <pixels> (optional)

Split Video

POST /api/split/video
Content-Type: multipart/form-data

video: <video file>
splitBy: manual|scenes
segments: [{"start": 0, "end": 30}, {"start": 30, "end": 60}] (for manual)
sceneThreshold: 0.1-1.0 (for scene detection)
maxSegments: <number>
outputFormat: mp4|avi|webm|mov
quality: low|medium|high|custom

GIF Processing

Split GIF into Frames

POST /api/split/gif
Content-Type: multipart/form-data

image: <gif file>
outputFormat: png|jpg|jpeg|webp
splitBy: frames|scenes
quality: 1-100
resize: <width>x<height> (optional)
skipDuplicates: true|false
maxFrames: <number>

Job Management

Check Job Status

GET /api/split/video/status/{jobId}
GET /api/split/gif/status/{jobId}

Response:

{
  "success": true,
  "jobId": "uuid-string",
  "status": "processing|completed|failed",
  "progress": {
    "totalSegments": 10,
    "completedSegments": 7,
    "percentage": 70
  },
  "result": { /* job results */ },
  "error": null
}

Download Results

GET /api/split/video/download/{jobId}/{filename}    # Individual file
GET /api/split/video/download-all/{jobId}           # ZIP archive
GET /api/split/gif/download/{jobId}/{filename}      # Individual frame
GET /api/split/gif/download-zip/{jobId}             # ZIP archive

Cancel Job

POST /api/split/video/cancel/{jobId}
POST /api/split/gif/cancel/{jobId}

File Management

Serve Converted Files

GET /api/files/{filename}

Health Check

GET /health

πŸ§ͺ Testing

Run Backend Tests

cd backend
npm test

Run Frontend Tests

cd frontend
npm test

API Testing with curl

# Convert image
curl -X POST http://localhost:4000/api/convert \
  -F "files=@image.png" \
  -F "targetFormat=jpg" \
  -F "quality=85"

# Split video by scenes
curl -X POST http://localhost:4000/api/split/video \
  -F "video=@video.mp4" \
  -F "splitBy=scenes" \
  -F "sceneThreshold=0.3" \
  -F "outputFormat=mp4"

πŸ“¦ Deployment

Production Build

# Build frontend
cd frontend
npm run build

# Start production server
cd ../backend
npm start

Docker Deployment

# Dockerfile example
FROM node:18-alpine

# Install FFmpeg
RUN apk add --no-cache ffmpeg

# Copy and install dependencies
WORKDIR /app
COPY package*.json ./
RUN npm install --production

# Copy source code
COPY . .

EXPOSE 4000
CMD ["npm", "start"]

πŸ”’ Security Features

  • File Type Validation: Strict MIME type checking
  • File Size Limits: Configurable upload size restrictions
  • Input Sanitization: Comprehensive input validation
  • Temporary File Cleanup: Automatic cleanup prevents disk overflow
  • Error Handling: Detailed errors without exposing internal structure
  • CORS Configuration: Proper cross-origin resource sharing setup

πŸ“ˆ Performance Optimization

  • Streaming Processing: Large files processed in streams
  • Memory Management: Efficient memory usage for large operations
  • Concurrent Processing: Multiple jobs handled simultaneously
  • Caching Strategy: Smart caching for frequently accessed files
  • Progress Tracking: Real-time progress updates for long operations

πŸ›£οΈ Roadmap

Phase 1: Enhanced Media Support

  • Audio file processing (MP3, WAV, FLAC)
  • PDF to image conversion
  • Advanced image filters and effects
  • Bulk operations API

Phase 2: AI Integration

  • Smart image upscaling
  • Automatic image enhancement
  • Content-aware cropping
  • Background removal

Phase 3: Cloud Integration

  • Cloud storage integration (AWS S3, Google Drive)
  • CDN integration for faster delivery
  • User accounts and history
  • API rate limiting and authentication

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Follow existing code style and conventions
  • Add tests for new features
  • Update documentation for API changes
  • Ensure all tests pass before submitting PR

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» About the Developer

Salimuddin is a passionate Full-Stack Developer and Media Processing Expert with extensive experience in building scalable web applications and media processing solutions.

Connect with Salimuddin


Built with ❀️ by Salimuddin

Professional Media Processing with Clean Architecture

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 91.1%
  • HTML 6.1%
  • CSS 2.7%
  • Other 0.1%