Skip to content

vittxr/files_compressor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Files compressor


A simple api to handle file compression, using ffmpeg.

Table of Contents

Introduction

This a simple API to handle file compression, using fastapi to handle the requests and ffmpeg to compress the files. The file must be sended as form-data.

Features

  • Video compression

Quick Start

create a virtualenv and install the requirements:

$ python3 -m venv venv 
$ pip install -r requirements.txt
$ source ./venv/bin/activate

run the app:

$ python main.py

app will be served by uvicorn in local, but for production is better use gunicorn.

to compression works, you'll need to install ffmpeg in your machine.

Testing

def compress_video(file):
    res = requests.post('http://127.0.0.1:8000/compress_form_data_video', data={'filename': file.filename, 'ext': file.filename.split('.')[-1]}, files={'file': file})
    
    if res.status_code >= 200 and res.status_code < 300:
       return res.content
    raise Exception('Cannot compress video')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages