From 545a6f64ffe2c88fbdd3096c6659c6d6cc9f3808 Mon Sep 17 00:00:00 2001 From: Unicate Date: Tue, 28 Mar 2023 09:08:07 +0700 Subject: [PATCH] fix typo for function splitForFFMPEG --- libs/events/utils.js | 4 ++-- libs/ffmpeg.js | 4 ++-- libs/ffmpeg/utils.js | 6 +++--- libs/monitor.js | 8 ++++---- libs/monitor/utils.js | 6 +++--- libs/timelapse.js | 4 ++-- libs/video/utils.js | 8 ++++---- test/run.js | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libs/events/utils.js b/libs/events/utils.js index 199025f3..d02db6d6 100644 --- a/libs/events/utils.js +++ b/libs/events/utils.js @@ -15,7 +15,7 @@ module.exports = (s,config,lang) => { const acceptableOperators = ['indexOf','!indexOf','===','!==','>=','>','<','<='] // Event Filters /> const { - splitForFFPMEG + splitForFFMPEG } = require('../ffmpeg/utils.js')(s,config,lang) const { moveCameraPtzToMatrix @@ -556,7 +556,7 @@ module.exports = (s,config,lang) => { s.debugLog(ffmpegCommand) activeMonitor.eventBasedRecording.process = spawn( config.ffmpegDir, - splitForFFPMEG(ffmpegCommand) + splitForFFMPEG(ffmpegCommand) ) activeMonitor.eventBasedRecording.process.stderr.on('data',function(data){ s.userLog(d,{ diff --git a/libs/ffmpeg.js b/libs/ffmpeg.js index 297541b1..7f79edbe 100644 --- a/libs/ffmpeg.js +++ b/libs/ffmpeg.js @@ -5,7 +5,7 @@ module.exports = async (s,config,lang,onFinish) => { const { sanitizedFfmpegCommand, createPipeArray, - splitForFFPMEG, + splitForFFMPEG, checkForWindows, checkForUnix, checkStaticBuilds, @@ -66,7 +66,7 @@ module.exports = async (s,config,lang,onFinish) => { //hold ffmpeg command for log stream activeMonitor.ffmpeg = sanitizedFfmpegCommand(e,ffmpegCommandString) //clean the string of spatial impurities and split for spawn() - const ffmpegCommandParsed = splitForFFPMEG(ffmpegCommandString) + const ffmpegCommandParsed = splitForFFMPEG(ffmpegCommandString) try{ fs.rmSync(e.sdir + 'cmd.txt') }catch(err){ diff --git a/libs/ffmpeg/utils.js b/libs/ffmpeg/utils.js index 4ac8331c..e20402ec 100644 --- a/libs/ffmpeg/utils.js +++ b/libs/ffmpeg/utils.js @@ -38,7 +38,7 @@ module.exports = (s,config,lang) => { activeProbes[auth] = 1 var stderr = '' var stdout = '' - const probeCommand = splitForFFPMEG(`${customInput ? customInput + ' ' : ''}-analyzeduration 10000 -probesize 10000 -v quiet -print_format json -show_format -show_streams -i "${url}"`) + const probeCommand = splitForFFMPEG(`${customInput ? customInput + ' ' : ''}-analyzeduration 10000 -probesize 10000 -v quiet -print_format json -show_format -show_streams -i "${url}"`) var processTimeout = null var ffprobeLocation = config.ffmpegDir.split('/') ffprobeLocation[ffprobeLocation.length - 1] = 'ffprobe' @@ -184,7 +184,7 @@ module.exports = (s,config,lang) => { } return stdioPipes } - const splitForFFPMEG = function(ffmpegCommandAsString) { + const splitForFFMPEG = function(ffmpegCommandAsString) { return ffmpegCommandAsString.replace(/\s+/g,' ').trim().match(/\\?.|^$/g).reduce((p, c) => { if(c === '"'){ p.quote ^= 1; @@ -378,7 +378,7 @@ Run "npm install ffbinaries" to get this static FFmpeg downloader.` validateDimensions: validateDimensions, sanitizedFfmpegCommand: sanitizedFfmpegCommand, createPipeArray: createPipeArray, - splitForFFPMEG: splitForFFPMEG, + splitForFFMPEG: splitForFFMPEG, checkForWindows: checkForWindows, checkForUnix: checkForUnix, checkForNpmStatic: checkForNpmStatic, diff --git a/libs/monitor.js b/libs/monitor.js index bd0c6f86..4a366722 100644 --- a/libs/monitor.js +++ b/libs/monitor.js @@ -12,7 +12,7 @@ module.exports = function(s,config,lang){ asyncSetTimeout, } = require('./basic/utils.js')(process.cwd(),config) const { - splitForFFPMEG, + splitForFFMPEG, } = require('./ffmpeg/utils.js')(s,config,lang) const { processKill, @@ -194,7 +194,7 @@ module.exports = function(s,config,lang){ var iconImageFile = streamDir + 'icon.jpg' const snapRawFilters = monitor.details.cust_snap_raw if(snapRawFilters)outputOptions.push(snapRawFilters); - var ffmpegCmd = splitForFFPMEG(`-y -loglevel warning ${isDetectorStream ? '-live_start_index 2' : ''} -re ${inputOptions.join(' ')} -i "${url}" ${outputOptions.join(' ')} -f image2 -an -frames:v 1 "${temporaryImageFile}"`) + var ffmpegCmd = splitForFFMPEG(`-y -loglevel warning ${isDetectorStream ? '-live_start_index 2' : ''} -re ${inputOptions.join(' ')} -i "${url}" ${outputOptions.join(' ')} -f image2 -an -frames:v 1 "${temporaryImageFile}"`) try{ await fs.promises.mkdir(streamDir, {recursive: true}, (err) => {s.debugLog(err)}) }catch(err){ @@ -316,7 +316,7 @@ module.exports = function(s,config,lang){ //not exist var cat = 'cat '+copiedItems.join(' ')+' > '+allts exec(cat,function(){ - var merger = spawn(config.ffmpegDir,splitForFFPMEG(('-re -i '+allts+' -acodec copy -vcodec copy -t 00:00:' + videoLength + ' '+pathDir+mergedFile))) + var merger = spawn(config.ffmpegDir,splitForFFMPEG(('-re -i '+allts+' -acodec copy -vcodec copy -t 00:00:' + videoLength + ' '+pathDir+mergedFile))) merger.stderr.on('data',function(data){ s.userLog(monitor,{type:"Buffer Merge",msg:data.toString()}) }) @@ -405,7 +405,7 @@ module.exports = function(s,config,lang){ ke: groupKey, mid: '$USER' },{type:lang['Videos Merge'],msg:mergedFile}) - var merger = spawn(config.ffmpegDir,splitForFFPMEG(('-re -loglevel warning -i ' + mergedRawFilepath + ' -acodec copy -vcodec copy ' + mergedFilepath))) + var merger = spawn(config.ffmpegDir,splitForFFMPEG(('-re -loglevel warning -i ' + mergedRawFilepath + ' -acodec copy -vcodec copy ' + mergedFilepath))) merger.stderr.on('data',function(data){ s.userLog({ ke: groupKey, diff --git a/libs/monitor/utils.js b/libs/monitor/utils.js index 01ce2840..feb7be82 100644 --- a/libs/monitor/utils.js +++ b/libs/monitor/utils.js @@ -16,7 +16,7 @@ module.exports = (s,config,lang) => { createWarningsForConfiguration, buildMonitorConfigPartialFromWarnings, createPipeArray, - splitForFFPMEG, + splitForFFMPEG, sanitizedFfmpegCommand, } = require('../ffmpeg/utils.js')(s,config,lang) const { @@ -220,7 +220,7 @@ module.exports = (s,config,lang) => { }) } const temporaryImageFile = streamDir + s.gid(5) + '.jpg' - const ffmpegCmd = splitForFFPMEG(`-y -loglevel warning -re ${inputOptions.join(' ')} -i "${url}" ${outputOptions.join(' ')} -f image2 -an -frames:v 1 "${temporaryImageFile}"`) + const ffmpegCmd = splitForFFMPEG(`-y -loglevel warning -re ${inputOptions.join(' ')} -i "${url}" ${outputOptions.join(' ')} -f image2 -an -frames:v 1 "${temporaryImageFile}"`) const snapProcess = spawn('ffmpeg',ffmpegCmd,{detached: true}) snapProcess.stderr.on('data',function(data){ // s.debugLog(data.toString()) @@ -306,7 +306,7 @@ module.exports = (s,config,lang) => { }); const ffmpegCommandString = ffmpegCommand.join(' ') activeMonitor.ffmpegSubstream = sanitizedFfmpegCommand(e,ffmpegCommandString) - const ffmpegCommandParsed = splitForFFPMEG(ffmpegCommandString) + const ffmpegCommandParsed = splitForFFMPEG(ffmpegCommandString) activeMonitor.subStreamChannel = channelNumber; s.userLog({ ke: groupKey, diff --git a/libs/timelapse.js b/libs/timelapse.js index 5e72be1f..a50de947 100644 --- a/libs/timelapse.js +++ b/libs/timelapse.js @@ -9,7 +9,7 @@ module.exports = function(s,config,lang,app,io){ sendTimelapseFrameToMasterNode, } = require('./childNode/childUtils.js')(s,config,lang) const { - splitForFFPMEG, + splitForFFMPEG, } = require('./ffmpeg/utils.js')(s,config,lang) const { getFileDirectory, @@ -239,7 +239,7 @@ module.exports = function(s,config,lang,app,io){ const numberOfFrames = framesAccepted.length const commandString = `-y -threads 1 -re -f concat -safe 0 -r ${framesPerSecond} -i "${concatListFile}" -q:v 1 -c:v libx264 -preset ultrafast -r ${framesPerSecond} "${finalMp4OutputLocation}"` s.debugLog("ffmpeg",commandString) - const videoBuildProcess = spawn(config.ffmpegDir,splitForFFPMEG(commandString)) + const videoBuildProcess = spawn(config.ffmpegDir,splitForFFMPEG(commandString)) videoBuildProcess.stdout.on('data',function(data){ s.debugLog('stdout',finalMp4OutputLocation,data.toString()) }) diff --git a/libs/video/utils.js b/libs/video/utils.js index 76e2e0eb..8512e660 100644 --- a/libs/video/utils.js +++ b/libs/video/utils.js @@ -4,7 +4,7 @@ const async = require('async'); module.exports = (s,config,lang) => { const { ffprobe, - splitForFFPMEG, + splitForFFMPEG, } = require('../ffmpeg/utils.js')(s,config,lang) const { copyFile, @@ -257,7 +257,7 @@ module.exports = (s,config,lang) => { const finalMp4OutputLocation = options.output const commandString = `-y -threads 1 -f concat -safe 0 -i "${concatListFile}" -c:v copy -an -preset ultrafast "${finalMp4OutputLocation}"` s.debugLog("stitchMp4Files",commandString) - const videoBuildProcess = spawn(config.ffmpegDir,splitForFFPMEG(commandString)) + const videoBuildProcess = spawn(config.ffmpegDir,splitForFFMPEG(commandString)) videoBuildProcess.stdout.on('data',function(data){ s.debugLog('stdout',finalMp4OutputLocation,data.toString()) }) @@ -286,7 +286,7 @@ module.exports = (s,config,lang) => { const outputFilePath = `${videoFolder}${tempFilename}` const commandString = `-y -threads 1 -re -i "${inputFilePath}" -c:v copy -c:a copy -preset ultrafast "${outputFilePath}"` fixingAlready[fixingId] = true - const videoBuildProcess = spawn(config.ffmpegDir,splitForFFPMEG(commandString)) + const videoBuildProcess = spawn(config.ffmpegDir,splitForFFMPEG(commandString)) videoBuildProcess.stdout.on('data',function(data){ s.debugLog('stdout',outputFilePath,data.toString()) }) @@ -409,7 +409,7 @@ module.exports = (s,config,lang) => { oldName: filename, name: finalFilename, },'GRP_'+groupKey); - const videoBuildProcess = spawn(config.ffmpegDir,splitForFFPMEG(commandString)) + const videoBuildProcess = spawn(config.ffmpegDir,splitForFFMPEG(commandString)) videoBuildProcess.stdout.on('data',function(data){ s.debugLog('stdout',outputFilePath,data.toString()) }) diff --git a/test/run.js b/test/run.js index 2e18014c..d81bffa3 100644 --- a/test/run.js +++ b/test/run.js @@ -135,14 +135,14 @@ module.exports = function(s,config,lang,io){ } }, "ffmpeg.js" : { - splitForFFPMEG : function(next){ + splitForFFMPEG : function(next){ var expectedResult = [ 'flag1', 'flag2', 'fl ag3', ] - var testResult = s.splitForFFPMEG('flag1 flag2 "fl ag3"') - checkResult('Internal Function : splitForFFPMEG',JSON.stringify(expectedResult),JSON.stringify(testResult)) + var testResult = s.splitForFFMPEG('flag1 flag2 "fl ag3"') + checkResult('Internal Function : splitForFFMPEG',JSON.stringify(expectedResult),JSON.stringify(testResult)) next() }, "ffmpeg" : function(next){