修复FFPROBE依赖
This commit is contained in:
@@ -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=
|
||||
|
||||
@@ -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`).
|
||||
|
||||
@@ -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",
|
||||
|
||||
12
server.js
12
server.js
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user