Skip to content

Commit

Permalink
Update for AI dubbing
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Sep 9, 2024
1 parent eca4f60 commit 1d3cb20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion install/checkConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
12 changes: 7 additions & 5 deletions objects/HLSProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
}

Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions update/updateDb.v6.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UPDATE configurations_encoder SET version = '6.0', modified = now() WHERE id = 1;

0 comments on commit 1d3cb20

Please sign in to comment.