small facelift

This commit is contained in:
nmi.dima.hu 2022-06-22 09:09:14 +02:00
parent ae4c450f10
commit 6b321fc407
1 changed files with 14 additions and 0 deletions

View File

@ -89,6 +89,7 @@ while (true) :
{
logger(3, 'Non-clean exit (expected), checking if output directory is empty');
if (is_dir_empty($output_directory))
{
if (@rmdir($output_directory))
logger(4, 'Output directory removed');
else
@ -96,6 +97,19 @@ while (true) :
logger(4, 'Unable to remove output directory');
notify('Error', 'The FFMPEG process shut down with exit code '.$exitcode.' and the output directory is empty (nothing recorded). Output directory should have been removed automatically, but the process failed. Remove the output directory manually: '.$output_directory, 4);
}
}
}
if (file_exists($output_directory.'/index.m3u8'))
{
exec('ffmpeg -i '.$output_directory.'/index.m3u8 -acodec copy -vcodec copy '.$_set->vod.'/'.basename($output_directory).'.mp4');
if (file_exists($_set->vod.'/'.basename($output_directory).'.mp4'))
{
logger(4, 'Conversion to single file successful');
notify('Conversion successful', 'The HLS stream is now available as an MP4 file here: '.$_set->vod.'/'.basename($output_directory).'.mp4', 4);
} else {
logger(4, 'Conversion to single file failed');
notify('Conversion unsuccessful', 'The output file of FFMPEG does not exists. This is an indiction that the conversion failed.', 4);
}
}
} else
logger(3, 'Unable to create output directory');