From 64c34b74c47c5d277a34d34516e018fca2b60c1d Mon Sep 17 00:00:00 2001 From: Matthias Van Parijs Date: Mon, 9 Sep 2024 21:33:43 +0200 Subject: [PATCH] chore: Added ffmpeg installer --- packages/artisan/package.json | 1 + .../artisan/src/consumer/workers/ffmpeg.ts | 5 ++ pnpm-lock.yaml | 80 +++++++++++++++++++ 3 files changed, 86 insertions(+) diff --git a/packages/artisan/package.json b/packages/artisan/package.json index cb0f35f6..8ac94375 100644 --- a/packages/artisan/package.json +++ b/packages/artisan/package.json @@ -32,6 +32,7 @@ }, "dependencies": { "@aws-sdk/client-s3": "^3.623.0", + "@ffmpeg-installer/ffmpeg": "^1.1.0", "bullmq": "^5.12.0", "dotenv": "^16.4.5", "find-config": "^1.0.0", diff --git a/packages/artisan/src/consumer/workers/ffmpeg.ts b/packages/artisan/src/consumer/workers/ffmpeg.ts index 65c1d393..d85a61a5 100644 --- a/packages/artisan/src/consumer/workers/ffmpeg.ts +++ b/packages/artisan/src/consumer/workers/ffmpeg.ts @@ -2,10 +2,15 @@ import { dirSync } from "tmp"; import ffmpeg from "fluent-ffmpeg"; import { downloadFile, uploadFile } from "../s3.js"; import parseFilePath from "parse-filepath"; +import ffmpegBin from "@ffmpeg-installer/ffmpeg"; import type { Job } from "bullmq"; import type { Stream, Input } from "../../schemas.js"; import type { FfmpegCommand } from "fluent-ffmpeg"; +console.log("Set ffmpeg path to", ffmpegBin.path); + +ffmpeg.setFfmpegPath(ffmpegBin.path); + export type FfmpegData = { params: { input: Input; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 69ccd8e9..9ffb2758 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -87,6 +87,9 @@ importers: '@aws-sdk/client-s3': specifier: ^3.623.0 version: 3.623.0 + '@ffmpeg-installer/ffmpeg': + specifier: ^1.1.0 + version: 1.1.0 bullmq: specifier: ^5.12.0 version: 5.12.0 @@ -3039,6 +3042,83 @@ packages: hashlru: 2.3.0 dev: false + /@ffmpeg-installer/darwin-arm64@4.1.5: + resolution: {integrity: sha512-hYqTiP63mXz7wSQfuqfFwfLOfwwFChUedeCVKkBtl/cliaTM7/ePI9bVzfZ2c+dWu3TqCwLDRWNSJ5pqZl8otA==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@ffmpeg-installer/darwin-x64@4.1.0: + resolution: {integrity: sha512-Z4EyG3cIFjdhlY8wI9aLUXuH8nVt7E9SlMVZtWvSPnm2sm37/yC2CwjUzyCQbJbySnef1tQwGG2Sx+uWhd9IAw==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@ffmpeg-installer/ffmpeg@1.1.0: + resolution: {integrity: sha512-Uq4rmwkdGxIa9A6Bd/VqqYbT7zqh1GrT5/rFwCwKM70b42W5gIjWeVETq6SdcL0zXqDtY081Ws/iJWhr1+xvQg==} + optionalDependencies: + '@ffmpeg-installer/darwin-arm64': 4.1.5 + '@ffmpeg-installer/darwin-x64': 4.1.0 + '@ffmpeg-installer/linux-arm': 4.1.3 + '@ffmpeg-installer/linux-arm64': 4.1.4 + '@ffmpeg-installer/linux-ia32': 4.1.0 + '@ffmpeg-installer/linux-x64': 4.1.0 + '@ffmpeg-installer/win32-ia32': 4.1.0 + '@ffmpeg-installer/win32-x64': 4.1.0 + dev: false + + /@ffmpeg-installer/linux-arm64@4.1.4: + resolution: {integrity: sha512-dljEqAOD0oIM6O6DxBW9US/FkvqvQwgJ2lGHOwHDDwu/pX8+V0YsDL1xqHbj1DMX/+nP9rxw7G7gcUvGspSoKg==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@ffmpeg-installer/linux-arm@4.1.3: + resolution: {integrity: sha512-NDf5V6l8AfzZ8WzUGZ5mV8O/xMzRag2ETR6+TlGIsMHp81agx51cqpPItXPib/nAZYmo55Bl2L6/WOMI3A5YRg==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@ffmpeg-installer/linux-ia32@4.1.0: + resolution: {integrity: sha512-0LWyFQnPf+Ij9GQGD034hS6A90URNu9HCtQ5cTqo5MxOEc7Rd8gLXrJvn++UmxhU0J5RyRE9KRYstdCVUjkNOQ==} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@ffmpeg-installer/linux-x64@4.1.0: + resolution: {integrity: sha512-Y5BWhGLU/WpQjOArNIgXD3z5mxxdV8c41C+U15nsE5yF8tVcdCGet5zPs5Zy3Ta6bU7haGpIzryutqCGQA/W8A==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@ffmpeg-installer/win32-ia32@4.1.0: + resolution: {integrity: sha512-FV2D7RlaZv/lrtdhaQ4oETwoFUsUjlUiasiZLDxhEUPdNDWcH1OU9K1xTvqz+OXLdsmYelUDuBS/zkMOTtlUAw==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: false + optional: true + + /@ffmpeg-installer/win32-x64@4.1.0: + resolution: {integrity: sha512-Drt5u2vzDnIONf4ZEkKtFlbvwj6rI3kxw1Ck9fpudmtgaZIHD4ucsWB2lCZBXRxJgXR+2IMSti+4rtM4C4rXgg==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: false + optional: true + /@floating-ui/core@1.6.7: resolution: {integrity: sha512-yDzVT/Lm101nQ5TCVeK65LtdN7Tj4Qpr9RTXJ2vPFLqtLxwOrpoxAHAJI8J3yYWUc40J0BDBheaitK5SJmno2g==} dependencies: