adjust raw snapshot from detectorStream.m3u8
parent
efe703dfc0
commit
9661f019d0
|
@ -161,12 +161,13 @@ module.exports = function(s,config,lang){
|
||||||
return new Promise((resolve,reject) => {
|
return new Promise((resolve,reject) => {
|
||||||
options = options instanceof Object ? options : {flags: ''}
|
options = options instanceof Object ? options : {flags: ''}
|
||||||
s.checkDetails(monitor)
|
s.checkDetails(monitor)
|
||||||
|
let isDetectorStream = false
|
||||||
var inputOptions = []
|
var inputOptions = []
|
||||||
var outputOptions = []
|
var outputOptions = []
|
||||||
var streamDir = s.dir.streams + monitor.ke + '/' + monitor.mid + '/'
|
var streamDir = s.dir.streams + monitor.ke + '/' + monitor.mid + '/'
|
||||||
var url = options.url
|
var url = options.url
|
||||||
var secondsInward = options.secondsInward || '0'
|
var secondsInward = options.secondsInward || '0'
|
||||||
if(secondsInward.length === 1)secondsInward = '0' + secondsInward
|
if(secondsInward.length === 1 && !isNaN(secondsInward))secondsInward = '0' + secondsInward
|
||||||
var dynamicTimeout = (secondsInward * 1000) + 5000
|
var dynamicTimeout = (secondsInward * 1000) + 5000
|
||||||
if(options.flags)outputOptions.push(options.flags)
|
if(options.flags)outputOptions.push(options.flags)
|
||||||
const checkExists = function(streamDir,callback){
|
const checkExists = function(streamDir,callback){
|
||||||
|
@ -202,7 +203,7 @@ module.exports = function(s,config,lang){
|
||||||
var snapBuffer = []
|
var snapBuffer = []
|
||||||
var temporaryImageFile = streamDir + s.gid(5) + '.jpg'
|
var temporaryImageFile = streamDir + s.gid(5) + '.jpg'
|
||||||
var iconImageFile = streamDir + 'icon.jpg'
|
var iconImageFile = streamDir + 'icon.jpg'
|
||||||
var ffmpegCmd = splitForFFPMEG(`-y -loglevel warning -re ${inputOptions.join(' ')} -i "${url}" ${outputOptions.join(' ')} -f image2 -an -frames:v 1 "${temporaryImageFile}"`)
|
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}"`)
|
||||||
checkExists(streamDir, function(success) {
|
checkExists(streamDir, function(success) {
|
||||||
if (success === false) {
|
if (success === false) {
|
||||||
fs.mkdirSync(streamDir, {recursive: true}, (err) => {s.debugLog(err)})
|
fs.mkdirSync(streamDir, {recursive: true}, (err) => {s.debugLog(err)})
|
||||||
|
@ -270,6 +271,7 @@ module.exports = function(s,config,lang){
|
||||||
runExtraction()
|
runExtraction()
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
|
isDetectorStream = true
|
||||||
outputOptions.push(`-ss 00:00:${secondsInward}`)
|
outputOptions.push(`-ss 00:00:${secondsInward}`)
|
||||||
url = streamDir + 'detectorStream.m3u8'
|
url = streamDir + 'detectorStream.m3u8'
|
||||||
runExtraction()
|
runExtraction()
|
||||||
|
|
Loading…
Reference in New Issue