From 1d3cb204d54e463f18acdb4365ad83e43cd855fc Mon Sep 17 00:00:00 2001 From: Daniel Neto Date: Mon, 9 Sep 2024 11:50:54 -0300 Subject: [PATCH] Update for AI dubbing --- install/checkConfiguration.php | 2 +- objects/HLSProcessor.php | 12 +++++++----- update/updateDb.v6.0.sql | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 update/updateDb.v6.0.sql diff --git a/install/checkConfiguration.php b/install/checkConfiguration.php index a5d30e2f..83acb23a 100644 --- a/install/checkConfiguration.php +++ b/install/checkConfiguration.php @@ -7,7 +7,7 @@ $_POST['databaseName'] = str_replace('-', '_', $_POST['databaseName']); require_once '../objects/functions.php'; -$installationVersion = '5.2'; +$installationVersion = '6.0'; header('Content-Type: application/json'); diff --git a/objects/HLSProcessor.php b/objects/HLSProcessor.php index 6cfff85f..c5041661 100644 --- a/objects/HLSProcessor.php +++ b/objects/HLSProcessor.php @@ -35,12 +35,14 @@ public static function createHLSWithAudioTracks($pathFileName, $destinationFile) file_put_contents($destinationFile . $keyFileName, $key); // Create keyinfo file for HLS encryption - $str = "../{$keyFileName}\n{$destinationFile}{$keyFileName}"; + $str = "../{$keyFileName}".PHP_EOL; + $str .= "{$destinationFile}{$keyFileName}"; file_put_contents($keyInfoFile, $str); } // Initialize the master playlist content - $masterPlaylist = "#EXTM3U\n#EXT-X-VERSION:3\n"; + $masterPlaylist = "#EXTM3U".PHP_EOL; + $masterPlaylist .= "#EXT-X-VERSION:3".PHP_EOL; // Generate separate audio-only HLS streams for each audio track foreach ($audioTracks as $key => $track) { @@ -69,7 +71,7 @@ public static function createHLSWithAudioTracks($pathFileName, $destinationFile) } else { // Add audio track entry to the master playlist $default = ($track->index == 0) ? "YES" : "NO"; // Set first audio track as default - $masterPlaylist .= "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio_group\",NAME=\"{$track->title}\",LANGUAGE=\"{$language}\",DEFAULT={$default},AUTOSELECT=YES,URI=\"audio_tracks/{$langDir}/audio.m3u8\"\n"; + $masterPlaylist .= "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"audio_group\",NAME=\"{$track->title}\",LANGUAGE=\"{$language}\",DEFAULT={$default},AUTOSELECT=YES,URI=\"audio_tracks/{$langDir}/audio.m3u8\"".PHP_EOL; } } @@ -86,7 +88,7 @@ public static function createHLSWithAudioTracks($pathFileName, $destinationFile) $outputFile = "{$dir}index.m3u8"; // Add resolution playlist entry to the master playlist - $masterPlaylist .= "#EXT-X-STREAM-INF:BANDWIDTH=" . ($rate * 1000) . ",RESOLUTION=-2x{$value},AUDIO=\"audio_group\"\n"; + $masterPlaylist .= "#EXT-X-STREAM-INF:BANDWIDTH=" . ($rate * 1000) . ",RESOLUTION=-2x{$value},AUDIO=\"audio_group\"".PHP_EOL; $masterPlaylist .= "res{$value}/index.m3u8".PHP_EOL; // Append FFmpeg command for this resolution @@ -108,7 +110,7 @@ public static function createHLSWithAudioTracks($pathFileName, $destinationFile) $outputFile = "{$dir}index.m3u8"; // Add resolution playlist entry to the master playlist - $masterPlaylist .= "#EXT-X-STREAM-INF:BANDWIDTH=" . ($rate * 1000) . ",RESOLUTION=-2x{$resolution},AUDIO=\"audio_group\"\n"; + $masterPlaylist .= "#EXT-X-STREAM-INF:BANDWIDTH=" . ($rate * 1000) . ",RESOLUTION=-2x{$resolution},AUDIO=\"audio_group\"".PHP_EOL; $masterPlaylist .= "res{$resolution}/index.m3u8".PHP_EOL; // Append FFmpeg command for this resolution diff --git a/update/updateDb.v6.0.sql b/update/updateDb.v6.0.sql new file mode 100644 index 00000000..65598e8a --- /dev/null +++ b/update/updateDb.v6.0.sql @@ -0,0 +1 @@ +UPDATE configurations_encoder SET version = '6.0', modified = now() WHERE id = 1; \ No newline at end of file