Development¶
This document describes how to develop and extend
django-video-transcoding.
Developing¶
Running tests¶
$> src/manage.py test
Type checking¶
$> pip install mypy django-stubs
$> cd src && mypy \
--config-file=../mypy.ini \
-p video_transcoding \
-p django_stubs_ext
Configuration¶
All configuration is stored in
video_transcoding.defaultsmodule.Most important variables are configured from ENV
settings.VIDEO_TRANSCODING_CONFIGmay be used for overriding defaults.
Extending¶
Celery application¶
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)celery master should set process group in order to send SIGUSR1 to workeres (see
video_transcoding.celery.set_same_process_group)
Transcoding implementation¶
extend
video_transcoding.tasks.TranscodeVideoto change task behaviortop-level transcoding strategy is selected in
TranscodeVideo.init_strategy, seevideo_transcoding.strategy.ResumableStrategyas an examplesee
video_transcoding.transcoding.transcodermodule for low-level transcoding steps examplesdealing with different intermediate files requires metadata extraction and specific logic for this process is implemented in
video_transcoding.transcoding.extract.Extractorsubclasses.missing metadata is restored by different analyzers in
video_transcoding.transcoding.analysismodule.
Model inheritance¶
For preset-related models use
<Model>Baseabstract models defined invideo_transcoding.models.For overriding
Videomodel setVIDEO_TRANSCODING_CONFIG["VIDEO_MODEL"]key toapp_label.ModelNameinsettings.Connect other django models to
Videousingvideo_transcoding.models.get_video_model().When
Videois overridden, video model admin is not registered automatically. As with migrations, this should be done manually.