A simple utility that allows to upload video on AWS Simple Storage Service(S3), provide specifications(video resolution and its audio frequency) to compress video and store compressed video as well on S3 such that next who want to see the video will able to download the compressed videos.
It uses postgreSQL as database, AWS S3 to store videos, ffmpeg to compress videos and redis for caching compress task.
##How it works?
- User upload video and provide specifications to compress it.
- Uncompressed video get saved on S3.
- At the same time it also get save on server disk.
- After that a task(that contain specification given by user, video name and primary key of above stored object) is send to queue(amqp) to compress video .
- Video gets compress using ffmpeg library.
- Lastly compressed video gets saved on S3 and same object is updated in database.
- Make sure you have installed Python 2.7.6, pip and virtualenv.
- Make sure you have PostgreSQL, Redis, ffmpeg installed.
- Make sure you have a bucket on AWS S3 and keys to access it.
- Clone the repo -
https://github.com/exploreshaifali/aws_s3_video_compress.git
and cd into theaws_s3_video_compress
directory. - Create a virtual environment with Python 2 and install dependencies:
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
- Create
video_compress_db
database, wherevideo_compress_db
might be any suitable name. - Fill in the database details in
aws_s3_video_compress/settings.py
. - Run
export SECRET_KEY=foobarbaz
in your terminal, ideally the secret key should be 40 characters long, unique and unpredictable. Optionally to set the shell variable every time you activate the virtualenv, editvenv/bin/activate
and add to the bottom the export statement. - Similarly set
DEFAULT_FILE_STORAGE
,AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
,AWS_STORAGE_BUCKET_NAME
for your AWS S3 inaws_s3_video_compress/settings.py
and updateBROKER_URL
,CELERY_RESULT_BACKEND
for django-celery. Default celery settings will be 'redis://127.0.0.1:6379/0' . - Run
python manage.py migrate
. - Run
python manage.py createsuperuser
to create a superuser for the admin panel. Fill in the details asked. - Run
python manage.py runserver
to start the development server.