Simple video transcoding application for Django framework
Project description
django-video-transcoding
Simple video transcoding application for Django Framework
Installation
System requirements
In case of latest Ubuntu LTS (20.04):
- ffmpeg-4.x
$> sudo apt install ffmpeg
- mediainfo
$> sudo apt install mediainfo
- RabbitMQ
$> sudo apt install rabbitmq-server
django-video-transcoding
pip install django-video-transcoding
Configure Django
Edit your project settings.py
INSTALLED_APPS += ['video_transcoding']
Env
Common env variables used in django web server and celery
DJANGO_SETTINGS_MODULE=YOUR_PROJECT.settings
VIDEO_TRANSCODING_CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:15672/
Web-server-only env variables:
VIDEO_DOWNLOAD_SOURCE=0
VIDEO_EDGES='http://edge-1.localhost,http://edge-2.localhost'
Celery-only env variables:
VIDEO_TEMP_DIR=/tmp
VIDEO_TRANSCODING_CELERY_CONCURRENCY=2
VIDEO_ORIGINS='http://origin-1.localhost/video,http://origin-2.localhost/video'
Start celery worker
$> celery worker -A video_transcoding.celery
Demo project
Run admin, storage and celery worker
docker-compose up
- http://localhost:8000/admin/ - Django admin (credentials are
admin:admin
) - http://storage.localhost:8080/videos/ - WebDAV for sources & results
- http://storage.localhost:8080/hls/ - HLS stream endpoint
Transcode something
curl -T cat.mp4 http://storage.localhost:8080/videos/sources/cat.mp4
- Create new video with link above
- Wait till video will change status to DONE.
- On video change form admin page there is a sample video player.
Develop
Tests
src/manage.py test
Type checking
$> pip install mypy django-stubs
$> cd src && /data/dvt/virtualenv/bin/dmypy run -- \
--config-file ../mypy.ini -p video_transcoding
TBD:
- travis-ci
- sphinx docs - autodoc + manual
- coverage
- typing
- badges
- video hosting demo project with docker-compose, nginx and player demo
Production
Graceful shutdown
- if you are running transcoder in docker, make sure that celery master process has pid 1 (docker will send SIGTERM to it by default)
- when using separate celery app, send SIGUSR1 from master to workers to trigger
soft shutdown handling
(see
video_transcoding.celery.send_term_to_children
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django_video_transcoding-0.5.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92ccb8b36967562c3f59fa11b768d0f6087e74894170ad3aff6b0240723d2a33 |
|
MD5 | 07fa0dce4731f74a5bb08ff812c2496d |
|
BLAKE2b-256 | 5dfafedef3af7237311201df82821acf2bbd0c8b337aa0344424f78ce1da6fb6 |
Close
Hashes for django_video_transcoding-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4914a62602bb08ff88b2ac65fca728a4928d76fc2e6cc893e9c8aa4ca85e6e3c |
|
MD5 | 19c67c3d004d893f43d0c49b2e1fa835 |
|
BLAKE2b-256 | 0c003da28a0225925d920beee4d6299aae56676dee193560f3ab2727ea2bd8aa |