修复FFPROBE依赖

This commit is contained in:
CN-JS-HuiBai
2026-04-03 01:52:03 +08:00
parent 056763e51d
commit 517814610d
4 changed files with 18 additions and 4 deletions

View File

@@ -11,3 +11,7 @@ S3_FORCE_PATH_STYLE=true
# Application Title
APP_TITLE=S3 Media Transcoder
# Optional: override bundled ffmpeg / ffprobe binaries
# FFMPEG_PATH=
# FFPROBE_PATH=

View File

@@ -2,9 +2,10 @@
To properly test and run this project, you will need to prepare your environment:
1. **Install Node.js & FFmpeg**:
1. **Install Node.js**:
- Ensure Node.js (v18+) is installed.
- Install **FFmpeg** on your system and make sure it is available in your PATH environment variable. The Node.js library `fluent-ffmpeg` requires it.
- The project uses npm-provided `ffmpeg-static` and `ffprobe-static` binaries by default, so you do not need to install FFmpeg globally.
- If you want to override the bundled binaries, set `FFMPEG_PATH` and `FFPROBE_PATH` in your environment.
2. **AWS S3 / MinIO Configuration**:
- Modify the `.env` file (copy from `.env.example`).

View File

@@ -12,6 +12,7 @@
"@aws-sdk/s3-request-presigner": "^3.540.0",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"ffprobe-static": "^3.1.0",
"express": "^4.19.2",
"ffmpeg-static": "^5.2.0",
"fluent-ffmpeg": "^2.1.3",

View File

@@ -7,12 +7,20 @@ const http = require('http');
const WebSocket = require('ws');
const ffmpeg = require('fluent-ffmpeg');
const ffmpegStatic = require('ffmpeg-static');
const ffprobeStatic = require('ffprobe-static');
const { S3Client, ListBucketsCommand, ListObjectsV2Command, GetObjectCommand } = require('@aws-sdk/client-s3');
dotenv.config();
if (ffmpegStatic) {
ffmpeg.setFfmpegPath(ffmpegStatic);
const configuredFfmpegPath = process.env.FFMPEG_PATH || ffmpegStatic;
const configuredFfprobePath = process.env.FFPROBE_PATH || ffprobeStatic.path;
if (configuredFfmpegPath) {
ffmpeg.setFfmpegPath(configuredFfmpegPath);
}
if (configuredFfprobePath) {
ffmpeg.setFfprobePath(configuredFfprobePath);
}
const app = express();