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.
This Fastify-based Node.js application uses FFmpeg to process video files. It provides API endpoints for uploading, trimming, and resizing videos.
- Upload a video file.
- Trim a video based on start and end times.
- Resize a video to specified dimensions.
- Node.js
-
Clone the repository:
git clone https://github.com/ishakzail/Video-resizer-trimmer
-
Install the dependencies
cd Video-resizer-trimmer npm install
-
Run the Project
npm run start
Note ⚠
- Concerning the uploaded file in the
resize-video
andtrim-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.
Endpoint: /api/upload-video
- Method: POST
- Request Body:
{ "video": File, }
Example (POSTMAN)
Endpoint: /api/resize-video
- Method: POST
- Request Body:
{ "video": File, "height": { "value": "480", "type": "string" }, "width": { "value": "640", "type": "string" } }
Example (POSTMAN)
Endpoint: /api/trim-video
- Method: POST
- Request Body:
{ "video": File, "startTime": { "value": "0", "type": "string" }, "endTime": { "value": "60", "type": "string" } }
Example (POSTMAN)