/Video-resizer-trimmer

This Node.js application built with Fastify and FFmpeg allows users to upload a video, trim it to a specified duration, and resize it to given dimensions.

Primary LanguageTypeScript

Fastify Video Processing API

This Node.js application built with Fastify and FFmpeg allows users to upload a video, trim it to a specified duration, and resize it to given dimensions.

Table of Contents

Introduction

This Fastify-based Node.js application uses FFmpeg to process video files. It provides API endpoints for uploading, trimming, and resizing videos.

Features

  1. Upload a video file.
  2. Trim a video based on start and end times.
  3. Resize a video to specified dimensions.

Getting Started

Prerequisites

  • Node.js

Installation

  1. Clone the repository:

    git clone https://github.com/ishakzail/Video-resizer-trimmer
  2. Install the dependencies

    cd Video-resizer-trimmer
    npm install
  3. Run the Project

    npm run start

Usage

Note ⚠

  • Concerning the uploaded file in the resize-video and trim-video APIs, they are initially stored in a temporary file. After processing, these temporary files are deleted, and the trimmed/resized videos are then stored in the uploads. folder.
  • For the uploaded file in the upload-video API, it is directly stored in the uploads folder.

Video Uploading

Endpoint: /api/upload-video

  • Method: POST
  • Request Body:
    {
      "video": File,
    }

Example (POSTMAN)

upload-video

Video Resizing

Endpoint: /api/resize-video

  • Method: POST
  • Request Body:
    {
      "video": File,
      "height": {
        "value": "480",
        "type": "string"
      },
      "width": {
        "value": "640",
        "type": "string"
      }
    }

Example (POSTMAN)

resize-video

Video Trimming

Endpoint: /api/trim-video

  • Method: POST
  • Request Body:
    {
      "video": File,
      "startTime": {
        "value": "0",
        "type": "string"
      },
      "endTime": {
        "value": "60",
        "type": "string"
      }
    }

Example (POSTMAN)

trim-video