init commit

This commit is contained in:
Trey t
2024-06-23 22:51:58 -05:00
commit ddf67a4fc5
315 changed files with 163458 additions and 0 deletions

17
video/tasks.py Normal file
View File

@@ -0,0 +1,17 @@
from celery import shared_task
import os
from django.conf import settings
import ffmpeg_streaming
from ffmpeg_streaming import Formats, Bitrate, Representation, Size
from django.core.files.storage import default_storage
@shared_task()
def create_hls_tasks(filename):
end_location = str(settings.MEDIA_ROOT) + "/" + str(filename) +'.m3u8'
if not default_storage.exists(end_location):
media_location = str(settings.MEDIA_ROOT) + "/" + str(filename)
video = ffmpeg_streaming.input(media_location)
hls = video.hls(Formats.h264())
_720p = Representation(Size(1280, 720), Bitrate(2048 * 1024, 320 * 1024))
hls.representations(_720p)
hls.output(end_location)