diff --git a/src/ffmpeg.js b/src/ffmpeg.js index a4f4c74..c503279 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -126,19 +126,8 @@ class FFMPEG extends events.EventEmitter { } - // Ensure startTime is a number (seconds), convert if needed - if (typeof startTime !== 'undefined') { - let ss = startTime; - if (typeof ss === 'string' && ss.endsWith('ms')) { - ss = parseInt(ss) / 1000; - } - if (typeof ss === 'number' && ss > 10000) { - // probably ms, convert to seconds - ss = ss / 1000; - } - ffmpegArgs.push(`-ss`, `${ss}`); - console.log(`[FFMPEG] Using custom start position: -ss ${ss}`); - } + if (typeof startTime !== 'undefined') + ffmpegArgs.push(`-ss`, startTime) if (isConcatPlaylist == true) ffmpegArgs.push(`-f`, `concat`, @@ -569,18 +558,9 @@ class FFMPEG extends events.EventEmitter { `service_name="${this.channel.name}"`, ); - // Ensure duration is a number (seconds), convert if needed + //t should be before -f if (typeof duration !== 'undefined') { - let t = duration; - if (typeof t === 'string' && t.endsWith('ms')) { - t = parseInt(t) / 1000; - } - if (typeof t === 'number' && t > 10000) { - // probably ms, convert to seconds - t = t / 1000; - } - ffmpegArgs.push(`-t`, `${t}`); - console.log(`[FFMPEG] Using custom duration: -t ${t}`); + ffmpegArgs.push(`-t`, `${duration}`); } ffmpegArgs.push(`-f`, `mpegts`, `pipe:1`)