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)
Metadata
Release files for django-video-transcoding 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_video_transcoding-0.9.0.tar.gz | 15.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_video_transcoding-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.4 kB
Release files / django_video_transcoding-0.9.0.tar.gz
| Download URL | django_video_transcoding-0.9.0.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4918fe12cf49f804d90e5fc505e4e253de582ca00719fee9edf0c812ebbaa49a
|
|
BLAKE2b-256 checksum How to use checksums |
cae7ecd91e4025eb9d5e94f862e4e21177d739e6e452d8b145a10708a2fecb82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / django_video_transcoding-0.9.0-py3-none-any.whl
| Download URL | django_video_transcoding-0.9.0-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75c43607708e5773aa8b3258c441c3c33130db67af91d9f3cdc72e494a35a209
|
|
BLAKE2b-256 checksum How to use checksums |
5184c3694d703ac8fc3f00ef9bc9af66f7c8199194ada51622b58993cce31203
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|