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 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.2.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

django_video_transcoding-0.2.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_video_transcoding-0.2.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for django_video_transcoding-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b4886d3523c20f2f473b20f28676ceac7bb961e7ee81f154e0d57e0f601fef94
MD5 4899da7a1726150b8fcc3c558a30c6f0
BLAKE2b-256 823c8abfdaada12e6fba46643c12ac390e3af5f26d7cb02295423db2be0aa82c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_video_transcoding-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for django_video_transcoding-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6206bc2b36ce4935756d07b0192d6ac751e0d02c71d1ac201a4a310e2c7c79d0
MD5 03bde3313f5d96e989569fd3c29af283
BLAKE2b-256 eb452446c3c579cff62910a58870457285cbf1f6dbcc0d6766780ef923904b48

See more details on using hashes here.

Supported by

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