Skip to main content

Simple video transcoding application for Django framework

Project description

django-video-transcoding

Simple video transcoding application for Django Framework

build codecov Updates PyPI version

Installation

System requirements

In case of latest Ubuntu LTS (20.04):

  1. ffmpeg-4.x
$> sudo apt install ffmpeg
  1. mediainfo
$> sudo apt install mediainfo 
  1. 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_video_transcoding-0.7.1.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

django_video_transcoding-0.7.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file django_video_transcoding-0.7.1.tar.gz.

File metadata

  • Download URL: django_video_transcoding-0.7.1.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for django_video_transcoding-0.7.1.tar.gz
Algorithm Hash digest
SHA256 66f5b419fac28b9e565594cfdb57e673d355c940209ca94721520e550cd348b7
MD5 1af4e098b69abef2357b3bf0680bbc22
BLAKE2b-256 6fb139f135aba126c54ef2851af302b2ab14b9817e1e6d03c312b56d6c26ca65

See more details on using hashes here.

File details

Details for the file django_video_transcoding-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: django_video_transcoding-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for django_video_transcoding-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f42fa09f4ada465da89d8f4511c65a7c3b78131d9843d2e0eae5f9d8cfdeaf8
MD5 0a80d6ccdb974a3e878672c887f8a9ff
BLAKE2b-256 cdfdb74bd54bb7c209622adc48521bef217298fad695122e9cfda34b0a8a8c8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page