Commit 61d53458 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

change ffmpeg commands

parent 39758cfe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
__version__ = "0.1.73"
__version__ = "0.1.74"
+26 −13
Original line number Diff line number Diff line
@@ -190,17 +190,17 @@ def make_hls(f: Union[models.File, int], force: bool = False):
            os.makedirs(hls_destination_dir, exist_ok=True)
            ffmpeg_cmd = [
                "ffmpeg",
                "-y",
                "-i",
                f.local_path(),
                "-filter_complex",
                (
                    "[0:v]split=3[v1][v2][v3];"
                    "[0:v]split=4[v1][v2][v3][v4];"
                    "[v1]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2:black[v1out];"
                    "[v2]scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2:black[v2out];"
                    "[v3]scale=854:480:force_original_aspect_ratio=decrease,pad=854:480:(ow-iw)/2:(oh-ih)/2:black[v3out]"
                    "[v3]scale=854:480:force_original_aspect_ratio=decrease,pad=854:480:(ow-iw)/2:(oh-ih)/2:black[v3out];"
                    "[v4]scale=426:240:force_original_aspect_ratio=decrease,pad=426:240:(ow-iw)/2:(oh-ih)/2:black[v4out]"
                ),
                # Video streams
                # video 1
                "-map",
                "[v1out]",
                "-c:v:0",
@@ -213,7 +213,6 @@ def make_hls(f: Union[models.File, int], force: bool = False):
                "5350k",
                "-bufsize:v:0",
                "7500k",
                # video 2
                "-map",
                "[v2out]",
                "-c:v:1",
@@ -226,7 +225,6 @@ def make_hls(f: Union[models.File, int], force: bool = False):
                "2996k",
                "-bufsize:v:1",
                "4200k",
                # video 3
                "-map",
                "[v3out]",
                "-c:v:2",
@@ -239,8 +237,18 @@ def make_hls(f: Union[models.File, int], force: bool = False):
                "1498k",
                "-bufsize:v:2",
                "2100k",
                # Audio streams
                # audio 1
                "-map",
                "[v4out]",
                "-c:v:3",
                "libx264",
                "-pix_fmt",
                "yuv420p",
                "-b:v:3",
                "700k",
                "-maxrate:v:3",
                "749k",
                "-bufsize:v:3",
                "1050k",
                "-map",
                "a:0",
                "-c:a:0",
@@ -249,7 +257,6 @@ def make_hls(f: Union[models.File, int], force: bool = False):
                "192k",
                "-ac",
                "2",
                # audio 2
                "-map",
                "a:0",
                "-c:a:1",
@@ -258,7 +265,6 @@ def make_hls(f: Union[models.File, int], force: bool = False):
                "128k",
                "-ac",
                "2",
                # audio 3
                "-map",
                "a:0",
                "-c:a:2",
@@ -267,7 +273,14 @@ def make_hls(f: Union[models.File, int], force: bool = False):
                "96k",
                "-ac",
                "2",
                # HLS settings
                "-map",
                "a:0",
                "-c:a:3",
                "aac",
                "-b:a:3",
                "64k",
                "-ac",
                "2",
                "-f",
                "hls",
                "-hls_time",
@@ -283,8 +296,7 @@ def make_hls(f: Union[models.File, int], force: bool = False):
                "-master_pl_name",
                "master.m3u8",
                "-var_stream_map",
                "v:0,a:0 v:1,a:1 v:2,a:2",
                # playlist output
                "v:0,a:0 v:1,a:1 v:2,a:2 v:3,a:3",
                f"{hls_destination_dir}stream_%v{os.path.sep}playlist.m3u8",
            ]

@@ -292,6 +304,7 @@ def make_hls(f: Union[models.File, int], force: bool = False):
            subprocess.run(
                [
                    "ffmpeg",
                    "-y",
                    "-i",
                    f.local_path(),
                    "-frames:v",
+3 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ from django.http import (
    HttpResponseBadRequest,
    FileResponse,
)
from django.contrib.auth.decorators import login_required
import pyvips
from resources.models import File
import os.path
@@ -11,6 +12,7 @@ from typing import Union
from jama import settings


@login_required
def simple_thumb(
    request: HttpRequest, sha256: str, size: int
) -> Union[FileResponse, HttpResponseNotFound, HttpResponseBadRequest]:
@@ -31,6 +33,7 @@ def simple_thumb(
    return FileResponse(open(tmp_pic_path, "rb"))


@login_required
def thumb(
    request: HttpRequest, sha256: str, angle: float, scale: float, crop: str
) -> Union[FileResponse, HttpResponseNotFound, HttpResponseBadRequest]:
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
    "preview": "vite preview"
  },
  "dependencies": {
    "@pdn-certic/vue3-jama": "^0.7.1",
    "@pdn-certic/vue3-jama": "0.7.3",
    "vue": "^3.5.25"
  },
  "devDependencies": {
+4 −4
Original line number Diff line number Diff line
@@ -299,10 +299,10 @@
  resolved "https://registry.yarnpkg.com/@mdi/font/-/font-7.4.47.tgz#2ae522867da3a5c88b738d54b403eb91471903af"
  integrity sha512-43MtGpd585SNzHZPcYowu/84Vz2a2g31TvPMTm9uTiCSWzaheQySUcSyUH/46fPnuPQWof2yd0pGBtzee/IQWw==

"@pdn-certic/vue3-jama@^0.7.1":
  version "0.7.1"
  resolved "https://git.unicaen.fr/api/v4/projects/855/packages/npm/@pdn-certic/vue3-jama/-/@pdn-certic/vue3-jama-0.7.1.tgz#baddc7332aab7a2bca3308e763b11443c8496825"
  integrity sha1-ut3HMyqreivKMwjnY7EUQ8hJaCU=
"@pdn-certic/vue3-jama@0.7.3":
  version "0.7.3"
  resolved "https://git.unicaen.fr/api/v4/projects/855/packages/npm/@pdn-certic/vue3-jama/-/@pdn-certic/vue3-jama-0.7.3.tgz#80fe10469909483e9e82533689afe0f23fbb21f6"
  integrity sha1-gP4QRpkJSD6eglM2ia/g8j+7IfY=
  dependencies:
    "@certic/certic-ouai" "0.0.26"
    "@mdi/font" "^7.4.47"