allow rtmp recording, hls buggy
This commit is contained in:
parent
a9a7a5d939
commit
a94d004a29
18
record.php
18
record.php
@ -47,6 +47,15 @@ if (!file_exists($config))
|
||||
if (!$_set = @json_decode(@file_get_contents($config)))
|
||||
logger(1, 'Unable to load or parse configuration file', 1, true);
|
||||
|
||||
// Check settings
|
||||
$_set_def = [
|
||||
'rtmp' => '',
|
||||
'recordhls' => false
|
||||
];
|
||||
foreach ($_set_def AS $i => $v)
|
||||
if (!isset($_set->{$i}))
|
||||
$_set->{$i} = $v;
|
||||
|
||||
// Loop indefinitely
|
||||
while (true) :
|
||||
|
||||
@ -69,10 +78,13 @@ while (true) :
|
||||
if (@mkdir($output_directory))
|
||||
{
|
||||
logger(2, 'All checks passed, starting ffmpeg');
|
||||
notify('Recording', 'Restreamer API reported that repeating to local nginx is connected and the HLS endpoint is found. The HLS output is now being recorded. HLS URL is the following: '.$_set->hls.', Output directory is: '.$output_directory, 2);
|
||||
exec('flock -n '.$_set->pid.' -c "ffmpeg -re -i '.$_set->hls.' -c copy '.$output_directory.'/index.m3u8 2> '.$output_directory.'/ffmpeg.log"', $output, $exitcode);
|
||||
notify('Recording', 'Restreamer API reported that repeating to local nginx is connected and the HLS endpoint is found. The HLS output is now being recorded. HLS URL is the following: '.$_set->hls.', Output directory is: '.$output_directory, 2);
|
||||
if ($_set->recordhls || !$_set->rtmp)
|
||||
exec('flock -n '.$_set->pid.' -c "ffmpeg -re -i '.$_set->hls.' -c copy '.$output_directory.'/index.m3u8 2> '.$output_directory.'/ffmpeg.log"', $output, $exitcode);
|
||||
else
|
||||
exec('flock -n '.$_set->pid.' -c "ffmpeg -re -i '.$_set->hls.' -c copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls '.$output_directory.'/index.m3u8 2> '.$output_directory.'/ffmpeg.log"', $output, $exitcode);
|
||||
logger(2, 'ffmpeg exited with code '.$exitcode);
|
||||
notify('Recording stopped', 'The FFMPEG process shut down with exit code: '.$exitcode, 2);
|
||||
notify('Recording stopped', 'The FFMPEG process shut down with exit code: '.$exitcode, 2);
|
||||
if ($exitcode)
|
||||
{
|
||||
logger(3, 'Non-clean exit (expected), checking if output directory is empty');
|
||||
|
Loading…
Reference in New Issue
Block a user