Skip to main content

Simple integration of a Django model with a FileField to encoding backends

Project description

https://img.shields.io/pypi/v/django-video-encoder.svg https://img.shields.io/pypi/pyversions/django-video-encoder.svg PyPI - Django Version

Simple integration with video encoding backends.

For now only the remote zencoder.com is supported.

Upload videos and asynchronously store the encoded videos and the generated thumbnails.

Requirements

Django 2.2+ and Celery to asynchronously run the encoding tasks.

Usage

You will need to add the following to your django settings:

  • Add django_video_encoder to INSTALLED_APPS

  • Add generic relation fields to your video models

    formats = GenericRelation(Format)
    thumbnails = GenericRelation(Thumbnail)
    
  • Set the DJANGO_VIDEO_ENCODER_THUMBNAIL_INTERVAL

  • Add the desired formats, for example

    DJANGO_VIDEO_ENCODER_FORMATS = {
        "H264 (HD)": {"video_codec": "h264"},  # full resolution if not specified
        "H264": {"video_codec": "h264", "width": 720, "height": 404},
        "VP9 (HD)": {"video_codec": "vp9"},
        "VP9": {"video_codec": "vp9", "width": 720, "height": 404},
    }
    

And specific settings using the zencoder backend:

  • Add ZENCODER_API_KEY and ZENCODER_NOTIFICATION_SECRET
  • You may also specify ZENCODER_REGION (default: europe) to the most suitable for you

DJANGO_VIDEO_ENCODER_FORMATS is a dictionary of {format_label: format_kwargs} where format_kwargs is a dictionary requiring video_codec and where all arguments are added to the encoding job POST. You can define width, height and much more see the Zencoder API.

Tests

Run tests with tox

Misc

To not be confused with the archived theonion/django-zencoder which is installed as zencoder

See also similar project escaped/django-video-encoding

Download files

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

Files for django-video-encoder, version 1.1.1
Filename, size File type Python version Upload date Hashes
Filename, size django_video_encoder-1.1.1-py3-none-any.whl (16.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django_video_encoder-1.1.1.tar.gz (11.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page