fix typo for function splitForFFMPEG
parent
a15fe04ace
commit
545a6f64ff
|
@ -15,7 +15,7 @@ module.exports = (s,config,lang) => {
|
||||||
const acceptableOperators = ['indexOf','!indexOf','===','!==','>=','>','<','<=']
|
const acceptableOperators = ['indexOf','!indexOf','===','!==','>=','>','<','<=']
|
||||||
// Event Filters />
|
// Event Filters />
|
||||||
const {
|
const {
|
||||||
splitForFFPMEG
|
splitForFFMPEG
|
||||||
} = require('../ffmpeg/utils.js')(s,config,lang)
|
} = require('../ffmpeg/utils.js')(s,config,lang)
|
||||||
const {
|
const {
|
||||||
moveCameraPtzToMatrix
|
moveCameraPtzToMatrix
|
||||||
|
@ -556,7 +556,7 @@ module.exports = (s,config,lang) => {
|
||||||
s.debugLog(ffmpegCommand)
|
s.debugLog(ffmpegCommand)
|
||||||
activeMonitor.eventBasedRecording.process = spawn(
|
activeMonitor.eventBasedRecording.process = spawn(
|
||||||
config.ffmpegDir,
|
config.ffmpegDir,
|
||||||
splitForFFPMEG(ffmpegCommand)
|
splitForFFMPEG(ffmpegCommand)
|
||||||
)
|
)
|
||||||
activeMonitor.eventBasedRecording.process.stderr.on('data',function(data){
|
activeMonitor.eventBasedRecording.process.stderr.on('data',function(data){
|
||||||
s.userLog(d,{
|
s.userLog(d,{
|
||||||
|
|
|
@ -5,7 +5,7 @@ module.exports = async (s,config,lang,onFinish) => {
|
||||||
const {
|
const {
|
||||||
sanitizedFfmpegCommand,
|
sanitizedFfmpegCommand,
|
||||||
createPipeArray,
|
createPipeArray,
|
||||||
splitForFFPMEG,
|
splitForFFMPEG,
|
||||||
checkForWindows,
|
checkForWindows,
|
||||||
checkForUnix,
|
checkForUnix,
|
||||||
checkStaticBuilds,
|
checkStaticBuilds,
|
||||||
|
@ -66,7 +66,7 @@ module.exports = async (s,config,lang,onFinish) => {
|
||||||
//hold ffmpeg command for log stream
|
//hold ffmpeg command for log stream
|
||||||
activeMonitor.ffmpeg = sanitizedFfmpegCommand(e,ffmpegCommandString)
|
activeMonitor.ffmpeg = sanitizedFfmpegCommand(e,ffmpegCommandString)
|
||||||
//clean the string of spatial impurities and split for spawn()
|
//clean the string of spatial impurities and split for spawn()
|
||||||
const ffmpegCommandParsed = splitForFFPMEG(ffmpegCommandString)
|
const ffmpegCommandParsed = splitForFFMPEG(ffmpegCommandString)
|
||||||
try{
|
try{
|
||||||
fs.rmSync(e.sdir + 'cmd.txt')
|
fs.rmSync(e.sdir + 'cmd.txt')
|
||||||
}catch(err){
|
}catch(err){
|
||||||
|
|
|
@ -38,7 +38,7 @@ module.exports = (s,config,lang) => {
|
||||||
activeProbes[auth] = 1
|
activeProbes[auth] = 1
|
||||||
var stderr = ''
|
var stderr = ''
|
||||||
var stdout = ''
|
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 processTimeout = null
|
||||||
var ffprobeLocation = config.ffmpegDir.split('/')
|
var ffprobeLocation = config.ffmpegDir.split('/')
|
||||||
ffprobeLocation[ffprobeLocation.length - 1] = 'ffprobe'
|
ffprobeLocation[ffprobeLocation.length - 1] = 'ffprobe'
|
||||||
|
@ -184,7 +184,7 @@ module.exports = (s,config,lang) => {
|
||||||
}
|
}
|
||||||
return stdioPipes
|
return stdioPipes
|
||||||
}
|
}
|
||||||
const splitForFFPMEG = function(ffmpegCommandAsString) {
|
const splitForFFMPEG = function(ffmpegCommandAsString) {
|
||||||
return ffmpegCommandAsString.replace(/\s+/g,' ').trim().match(/\\?.|^$/g).reduce((p, c) => {
|
return ffmpegCommandAsString.replace(/\s+/g,' ').trim().match(/\\?.|^$/g).reduce((p, c) => {
|
||||||
if(c === '"'){
|
if(c === '"'){
|
||||||
p.quote ^= 1;
|
p.quote ^= 1;
|
||||||
|
@ -378,7 +378,7 @@ Run "npm install ffbinaries" to get this static FFmpeg downloader.`
|
||||||
validateDimensions: validateDimensions,
|
validateDimensions: validateDimensions,
|
||||||
sanitizedFfmpegCommand: sanitizedFfmpegCommand,
|
sanitizedFfmpegCommand: sanitizedFfmpegCommand,
|
||||||
createPipeArray: createPipeArray,
|
createPipeArray: createPipeArray,
|
||||||
splitForFFPMEG: splitForFFPMEG,
|
splitForFFMPEG: splitForFFMPEG,
|
||||||
checkForWindows: checkForWindows,
|
checkForWindows: checkForWindows,
|
||||||
checkForUnix: checkForUnix,
|
checkForUnix: checkForUnix,
|
||||||
checkForNpmStatic: checkForNpmStatic,
|
checkForNpmStatic: checkForNpmStatic,
|
||||||
|
|
|
@ -12,7 +12,7 @@ module.exports = function(s,config,lang){
|
||||||
asyncSetTimeout,
|
asyncSetTimeout,
|
||||||
} = require('./basic/utils.js')(process.cwd(),config)
|
} = require('./basic/utils.js')(process.cwd(),config)
|
||||||
const {
|
const {
|
||||||
splitForFFPMEG,
|
splitForFFMPEG,
|
||||||
} = require('./ffmpeg/utils.js')(s,config,lang)
|
} = require('./ffmpeg/utils.js')(s,config,lang)
|
||||||
const {
|
const {
|
||||||
processKill,
|
processKill,
|
||||||
|
@ -194,7 +194,7 @@ module.exports = function(s,config,lang){
|
||||||
var iconImageFile = streamDir + 'icon.jpg'
|
var iconImageFile = streamDir + 'icon.jpg'
|
||||||
const snapRawFilters = monitor.details.cust_snap_raw
|
const snapRawFilters = monitor.details.cust_snap_raw
|
||||||
if(snapRawFilters)outputOptions.push(snapRawFilters);
|
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{
|
try{
|
||||||
await fs.promises.mkdir(streamDir, {recursive: true}, (err) => {s.debugLog(err)})
|
await fs.promises.mkdir(streamDir, {recursive: true}, (err) => {s.debugLog(err)})
|
||||||
}catch(err){
|
}catch(err){
|
||||||
|
@ -316,7 +316,7 @@ module.exports = function(s,config,lang){
|
||||||
//not exist
|
//not exist
|
||||||
var cat = 'cat '+copiedItems.join(' ')+' > '+allts
|
var cat = 'cat '+copiedItems.join(' ')+' > '+allts
|
||||||
exec(cat,function(){
|
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){
|
merger.stderr.on('data',function(data){
|
||||||
s.userLog(monitor,{type:"Buffer Merge",msg:data.toString()})
|
s.userLog(monitor,{type:"Buffer Merge",msg:data.toString()})
|
||||||
})
|
})
|
||||||
|
@ -405,7 +405,7 @@ module.exports = function(s,config,lang){
|
||||||
ke: groupKey,
|
ke: groupKey,
|
||||||
mid: '$USER'
|
mid: '$USER'
|
||||||
},{type:lang['Videos Merge'],msg:mergedFile})
|
},{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){
|
merger.stderr.on('data',function(data){
|
||||||
s.userLog({
|
s.userLog({
|
||||||
ke: groupKey,
|
ke: groupKey,
|
||||||
|
|
|
@ -16,7 +16,7 @@ module.exports = (s,config,lang) => {
|
||||||
createWarningsForConfiguration,
|
createWarningsForConfiguration,
|
||||||
buildMonitorConfigPartialFromWarnings,
|
buildMonitorConfigPartialFromWarnings,
|
||||||
createPipeArray,
|
createPipeArray,
|
||||||
splitForFFPMEG,
|
splitForFFMPEG,
|
||||||
sanitizedFfmpegCommand,
|
sanitizedFfmpegCommand,
|
||||||
} = require('../ffmpeg/utils.js')(s,config,lang)
|
} = require('../ffmpeg/utils.js')(s,config,lang)
|
||||||
const {
|
const {
|
||||||
|
@ -220,7 +220,7 @@ module.exports = (s,config,lang) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const temporaryImageFile = streamDir + s.gid(5) + '.jpg'
|
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})
|
const snapProcess = spawn('ffmpeg',ffmpegCmd,{detached: true})
|
||||||
snapProcess.stderr.on('data',function(data){
|
snapProcess.stderr.on('data',function(data){
|
||||||
// s.debugLog(data.toString())
|
// s.debugLog(data.toString())
|
||||||
|
@ -306,7 +306,7 @@ module.exports = (s,config,lang) => {
|
||||||
});
|
});
|
||||||
const ffmpegCommandString = ffmpegCommand.join(' ')
|
const ffmpegCommandString = ffmpegCommand.join(' ')
|
||||||
activeMonitor.ffmpegSubstream = sanitizedFfmpegCommand(e,ffmpegCommandString)
|
activeMonitor.ffmpegSubstream = sanitizedFfmpegCommand(e,ffmpegCommandString)
|
||||||
const ffmpegCommandParsed = splitForFFPMEG(ffmpegCommandString)
|
const ffmpegCommandParsed = splitForFFMPEG(ffmpegCommandString)
|
||||||
activeMonitor.subStreamChannel = channelNumber;
|
activeMonitor.subStreamChannel = channelNumber;
|
||||||
s.userLog({
|
s.userLog({
|
||||||
ke: groupKey,
|
ke: groupKey,
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = function(s,config,lang,app,io){
|
||||||
sendTimelapseFrameToMasterNode,
|
sendTimelapseFrameToMasterNode,
|
||||||
} = require('./childNode/childUtils.js')(s,config,lang)
|
} = require('./childNode/childUtils.js')(s,config,lang)
|
||||||
const {
|
const {
|
||||||
splitForFFPMEG,
|
splitForFFMPEG,
|
||||||
} = require('./ffmpeg/utils.js')(s,config,lang)
|
} = require('./ffmpeg/utils.js')(s,config,lang)
|
||||||
const {
|
const {
|
||||||
getFileDirectory,
|
getFileDirectory,
|
||||||
|
@ -239,7 +239,7 @@ module.exports = function(s,config,lang,app,io){
|
||||||
const numberOfFrames = framesAccepted.length
|
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}"`
|
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)
|
s.debugLog("ffmpeg",commandString)
|
||||||
const videoBuildProcess = spawn(config.ffmpegDir,splitForFFPMEG(commandString))
|
const videoBuildProcess = spawn(config.ffmpegDir,splitForFFMPEG(commandString))
|
||||||
videoBuildProcess.stdout.on('data',function(data){
|
videoBuildProcess.stdout.on('data',function(data){
|
||||||
s.debugLog('stdout',finalMp4OutputLocation,data.toString())
|
s.debugLog('stdout',finalMp4OutputLocation,data.toString())
|
||||||
})
|
})
|
||||||
|
|
|
@ -4,7 +4,7 @@ const async = require('async');
|
||||||
module.exports = (s,config,lang) => {
|
module.exports = (s,config,lang) => {
|
||||||
const {
|
const {
|
||||||
ffprobe,
|
ffprobe,
|
||||||
splitForFFPMEG,
|
splitForFFMPEG,
|
||||||
} = require('../ffmpeg/utils.js')(s,config,lang)
|
} = require('../ffmpeg/utils.js')(s,config,lang)
|
||||||
const {
|
const {
|
||||||
copyFile,
|
copyFile,
|
||||||
|
@ -257,7 +257,7 @@ module.exports = (s,config,lang) => {
|
||||||
const finalMp4OutputLocation = options.output
|
const finalMp4OutputLocation = options.output
|
||||||
const commandString = `-y -threads 1 -f concat -safe 0 -i "${concatListFile}" -c:v copy -an -preset ultrafast "${finalMp4OutputLocation}"`
|
const commandString = `-y -threads 1 -f concat -safe 0 -i "${concatListFile}" -c:v copy -an -preset ultrafast "${finalMp4OutputLocation}"`
|
||||||
s.debugLog("stitchMp4Files",commandString)
|
s.debugLog("stitchMp4Files",commandString)
|
||||||
const videoBuildProcess = spawn(config.ffmpegDir,splitForFFPMEG(commandString))
|
const videoBuildProcess = spawn(config.ffmpegDir,splitForFFMPEG(commandString))
|
||||||
videoBuildProcess.stdout.on('data',function(data){
|
videoBuildProcess.stdout.on('data',function(data){
|
||||||
s.debugLog('stdout',finalMp4OutputLocation,data.toString())
|
s.debugLog('stdout',finalMp4OutputLocation,data.toString())
|
||||||
})
|
})
|
||||||
|
@ -286,7 +286,7 @@ module.exports = (s,config,lang) => {
|
||||||
const outputFilePath = `${videoFolder}${tempFilename}`
|
const outputFilePath = `${videoFolder}${tempFilename}`
|
||||||
const commandString = `-y -threads 1 -re -i "${inputFilePath}" -c:v copy -c:a copy -preset ultrafast "${outputFilePath}"`
|
const commandString = `-y -threads 1 -re -i "${inputFilePath}" -c:v copy -c:a copy -preset ultrafast "${outputFilePath}"`
|
||||||
fixingAlready[fixingId] = true
|
fixingAlready[fixingId] = true
|
||||||
const videoBuildProcess = spawn(config.ffmpegDir,splitForFFPMEG(commandString))
|
const videoBuildProcess = spawn(config.ffmpegDir,splitForFFMPEG(commandString))
|
||||||
videoBuildProcess.stdout.on('data',function(data){
|
videoBuildProcess.stdout.on('data',function(data){
|
||||||
s.debugLog('stdout',outputFilePath,data.toString())
|
s.debugLog('stdout',outputFilePath,data.toString())
|
||||||
})
|
})
|
||||||
|
@ -409,7 +409,7 @@ module.exports = (s,config,lang) => {
|
||||||
oldName: filename,
|
oldName: filename,
|
||||||
name: finalFilename,
|
name: finalFilename,
|
||||||
},'GRP_'+groupKey);
|
},'GRP_'+groupKey);
|
||||||
const videoBuildProcess = spawn(config.ffmpegDir,splitForFFPMEG(commandString))
|
const videoBuildProcess = spawn(config.ffmpegDir,splitForFFMPEG(commandString))
|
||||||
videoBuildProcess.stdout.on('data',function(data){
|
videoBuildProcess.stdout.on('data',function(data){
|
||||||
s.debugLog('stdout',outputFilePath,data.toString())
|
s.debugLog('stdout',outputFilePath,data.toString())
|
||||||
})
|
})
|
||||||
|
|
|
@ -135,14 +135,14 @@ module.exports = function(s,config,lang,io){
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ffmpeg.js" : {
|
"ffmpeg.js" : {
|
||||||
splitForFFPMEG : function(next){
|
splitForFFMPEG : function(next){
|
||||||
var expectedResult = [
|
var expectedResult = [
|
||||||
'flag1',
|
'flag1',
|
||||||
'flag2',
|
'flag2',
|
||||||
'fl ag3',
|
'fl ag3',
|
||||||
]
|
]
|
||||||
var testResult = s.splitForFFPMEG('flag1 flag2 "fl ag3"')
|
var testResult = s.splitForFFMPEG('flag1 flag2 "fl ag3"')
|
||||||
checkResult('Internal Function : splitForFFPMEG',JSON.stringify(expectedResult),JSON.stringify(testResult))
|
checkResult('Internal Function : splitForFFMPEG',JSON.stringify(expectedResult),JSON.stringify(testResult))
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
"ffmpeg" : function(next){
|
"ffmpeg" : function(next){
|
||||||
|
|
Loading…
Reference in New Issue