diff --git a/conf/mysrs.conf b/conf/mysrs.conf index 428c8c2..ac8668b 100644 --- a/conf/mysrs.conf +++ b/conf/mysrs.conf @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index 85d71a2..82a5fb7 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 - - diff --git a/src/env.ts b/src/env.ts index bacc41e..c251cff 100644 --- a/src/env.ts +++ b/src/env.ts @@ -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'; \ No newline at end of file +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'; diff --git a/src/index.ts b/src/index.ts index 9acf0f9..8a9d359 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 diff --git a/src/thumbnail.ts b/src/thumbnail.ts index be2d222..2dc2d7b 100644 --- a/src/thumbnail.ts +++ b/src/thumbnail.ts @@ -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];