1
0
Fork 0
mirror of https://gitlab.com/Shinobi-Systems/ShinobiCE.git synced 2025-03-09 15:40:15 +00:00

fix ffmpeg crash on record

This commit is contained in:
Moe 2019-10-27 14:54:17 -07:00
parent 167603dfb0
commit 4b7a58d409

View file

@ -226,7 +226,7 @@ module.exports = function(s,config,lang,onFinish){
//`x` is an object used to contain temporary values. //`x` is an object used to contain temporary values.
var x = { var x = {
pipe: '', pipe: '',
cust_stream: '' cust_stream: ' -strict -2'
} }
if(!number||number==''){ if(!number||number==''){
x.channel_sdir = e.sdir; x.channel_sdir = e.sdir;
@ -478,7 +478,7 @@ module.exports = function(s,config,lang,onFinish){
//x = temporary values //x = temporary values
x.stream_video_filters = [] x.stream_video_filters = []
x.pipe = '' x.pipe = ''
x.cust_stream = '' x.cust_stream = ' -strict -2'
//stream - timestamp //stream - timestamp
if(e.details.stream_timestamp&&e.details.stream_timestamp=="1"&&e.details.vcodec!=='copy'){ if(e.details.stream_timestamp&&e.details.stream_timestamp=="1"&&e.details.vcodec!=='copy'){
//font //font
@ -659,6 +659,7 @@ module.exports = function(s,config,lang,onFinish){
//x = temporary values //x = temporary values
x.record_video_filters = [] x.record_video_filters = []
x.record_string = '' x.record_string = ''
x.cust_record = e.details.cust_record ? e.details.cust_record.split(' ') : []
//record - resolution //record - resolution
if(e.record_scale_x!==''&&e.record_scale_y!==''&&e.record_scale_x!=='0'&&e.record_scale_y!=='0'&&!isNaN(e.record_scale_x)&&!isNaN(e.record_scale_y)){ if(e.record_scale_x!==''&&e.record_scale_y!==''&&e.record_scale_x!=='0'&&e.record_scale_y!=='0'&&!isNaN(e.record_scale_x)&&!isNaN(e.record_scale_y)){
x.record_dimensions=' -s '+e.record_scale_x+'x'+e.record_scale_y x.record_dimensions=' -s '+e.record_scale_x+'x'+e.record_scale_y
@ -675,7 +676,7 @@ module.exports = function(s,config,lang,onFinish){
case'mp4': case'mp4':
x.vcodec='libx264';x.acodec='aac'; x.vcodec='libx264';x.acodec='aac';
if(e.details.crf&&e.details.crf!==''){x.vcodec+=' -crf '+e.details.crf} if(e.details.crf&&e.details.crf!==''){x.vcodec+=' -crf '+e.details.crf}
x.record_video_filters.push(`-segment_format_options movflags=faststart+frag_keyframe+empty_moov`) x.cust_record.push(`-segment_format_options movflags=faststart+frag_keyframe+empty_moov`)
break; break;
case'webm': case'webm':
x.acodec='libvorbis',x.vcodec='libvpx'; x.acodec='libvorbis',x.vcodec='libvpx';
@ -689,10 +690,8 @@ module.exports = function(s,config,lang,onFinish){
if(e.details.vcodec&&e.details.vcodec!==''&&e.details.vcodec!=='default'){x.vcodec=e.details.vcodec} if(e.details.vcodec&&e.details.vcodec!==''&&e.details.vcodec!=='default'){x.vcodec=e.details.vcodec}
//record - use custom audio codec //record - use custom audio codec
if(e.details.acodec&&e.details.acodec!==''&&e.details.acodec!=='default'){x.acodec=e.details.acodec} if(e.details.acodec&&e.details.acodec!==''&&e.details.acodec!=='default'){x.acodec=e.details.acodec}
if(e.details.cust_record){ if(e.details.cust_record.indexOf('-strict -2') === -1){x.cust_record.push(' -strict -2')}
if(x.acodec=='aac'&&e.details.cust_record.indexOf('-strict -2')===-1){e.details.cust_record+=' -strict -2';} if(e.details.cust_record.indexOf('-threads')===-1){x.cust_record.push(' -threads 1')}
if(e.details.cust_record.indexOf('-threads')===-1){e.details.cust_record+=' -threads 1';}
}
// if(e.details.cust_input&&(e.details.cust_input.indexOf('-use_wallclock_as_timestamps 1')>-1)===false){e.details.cust_input+=' -use_wallclock_as_timestamps 1';} // if(e.details.cust_input&&(e.details.cust_input.indexOf('-use_wallclock_as_timestamps 1')>-1)===false){e.details.cust_input+=' -use_wallclock_as_timestamps 1';}
//record - ready or reset codecs //record - ready or reset codecs
if(x.acodec!=='no'){ if(x.acodec!=='no'){
@ -765,7 +764,7 @@ module.exports = function(s,config,lang,onFinish){
break; break;
} }
//custom flags //custom flags
if(e.details.cust_record&&e.details.cust_record!==''){x.record_string+=' '+e.details.cust_record;} if(x.cust_record.length > 0){x.record_string+=' ' + x.cust_record.join(' ')}
//preset flag //preset flag
if(e.details.preset_record&&e.details.preset_record!==''){x.record_string+=' -preset '+e.details.preset_record;} if(e.details.preset_record&&e.details.preset_record!==''){x.record_string+=' -preset '+e.details.preset_record;}
//main string write //main string write