fix: made ffmpeg path configurable

This commit is contained in:
florian 2023-07-13 12:20:17 +02:00
parent e144b1231d
commit 4b427c35bf
5 changed files with 12 additions and 10 deletions

View File

@ -5,7 +5,7 @@ listen 1935;
max_connections 100;
#srs_log_tank file;
#srs_log_file ./objs/srs.log;
#daemon off;
daemon off;
http_api {
enabled on;
listen 1985;
@ -41,9 +41,6 @@ vhost __defaultVhost__ {
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp off;
}
play{
gop_cache_max_frames 2500;
}
dvr {
# DVR currently saves multiple times, we need to figure out how to save only once
# or sync the file with S3 more efficiently

View File

@ -1,3 +1,8 @@
#!/bin/bash
# Set FFMPEG_PATH if it's not already set
export FFMPEG_PATH=/usr/local/srs/objs/ffmpeg/bin/ffmpeg
# Start S3 upload tool
cd /usr/local/srs/upload
npm start &
@ -11,5 +16,3 @@ fi
cd /usr/local/srs
./objs/srs -c conf/mysrs.conf

View File

@ -8,5 +8,6 @@ export const MAX_TS_FILES_TO_KEEP = parseInt(process.env.MAX_TS_FILES_TO_KEEP ||
export const PORT = process.env.PORT || 3000;
export const CREATE_THUMBNAIL = process.env.CREATE_THUMBNAIL == undefined || process.env.CREATE_THUMBNAIL === 'true';
export const BUCKET_CLEANUP = process.env.BUCKET_CLEANUP == undefined || process.env.BUCKET_CLEANUP === 'true';
export const UPLOAD_RECORDING = process.env.UPLOAD_RECORDING == undefined || process.env.UPLOAD_RECORDING === 'true';
export const BUCKET_CLEANUP = process.env.BUCKET_CLEANUP === 'true'; // off by default
export const UPLOAD_RECORDING = process.env.UPLOAD_RECORDING === 'true'; // off by default
export const FFMPEG_PATH = process.env.FFMPEG_PATH || 'ffmpeg';

View File

@ -92,7 +92,7 @@ app.post('/api/v1/hls', async (req, res, next) => {
app.post('/api/v1/dvrs', async (req, res, next) => {
// console.debug('POST /api/v1/dvrs called: Received DVR update event.');
const dvrEvent = req.body as DVRUpdateEvent;
log('Received DVR event. Uploading ${dvrEvent.file} to S3.');
log(`Received DVR event. Uploading ${dvrEvent.file} to S3.`);
if (UPLOAD_RECORDING) {
// Queue the mp4 upload using a worker thread. The upload can take a

View File

@ -1,12 +1,13 @@
import { spawn } from 'child_process';
import { log } from './log';
import { createWriteStream, readFileSync, unlinkSync } from 'fs';
import { FFMPEG_PATH } from './env';
const VERBOSE = false;
export const createThumbnail = (sourceFileName: string, targetFileName: string) => {
return new Promise((resolve, reject) => {
var cmd = '/usr/local/srs/objs/ffmpeg/bin/ffmpeg';
var cmd = FFMPEG_PATH;
const errorOutput: string[] = [];
var args = ['-y', '-i', sourceFileName, '-an', '-vframes', '1', '-vf', 'scale=1280:720', targetFileName];