Simple video transcoding application for Django Framework
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
pip install django-video-transcoding
Edit your project settings.py
INSTALLED_APPS.append('video_transcoding')
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
Development environment quickstart guide
src/manage.py test
$> 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
- 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
)
Application settings can be set up via env variables, see video_transcoding.defaults
.
Also defaults can be overridden this via django.conf.settings.VIDEO_TRANSCODING_CONFIG
.
For preset-related models use <Model>Base
abstract models defined in video_transcoding.models
.
For overriding Video
model set VIDEO_TRANSCODING_CONFIG["VIDEO_MODEL"]
key to app_label.ModelName
in settings
.
Connect other django models to Video
using video_transcoding.models.get_video_model()
.
When Video
is overridden, video model admin is not registered automatically. As with migrations, this should be
done manually.