fix typo for function splitForFFMPEG

cycling-live-grid
Unicate 2023-03-28 09:08:07 +07:00
parent a15fe04ace
commit 545a6f64ff
8 changed files with 23 additions and 23 deletions

View File

@ -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,{

View File

@ -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){

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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())
})

View File

@ -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())
})

View File

@ -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){