Skip to content

Commit b7da420

Browse files
author
Daniel Neto
committed
Update with logs
1 parent 7aab22b commit b7da420

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

objects/Format.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,12 +889,15 @@ private static function exec($format_id, $pathFileName, $destinationFile, $encod
889889
if (empty($global['disableHLSAudioMultitrack'])) {
890890
_error_log("AVideo-Encoder Format::exec use HLSProcessor");
891891
$dynamic = HLSProcessor::createHLSWithAudioTracks($pathFileName, $destinationFile);
892+
_error_log("AVideo-Encoder Format::exec use HLSProcessor Complete");
892893
} else {
893894
_error_log("AVideo-Encoder Format::exec disableHLSAudioMultitrack");
894895
$dynamic = self::preProcessDynamicHLS($pathFileName, $destinationFile);
895896
}
896897
$destinationFile = $dynamic[0];
897898
$fc = $dynamic[1];
899+
900+
_error_log("AVideo-Encoder Format::exec destinationFile=$destinationFile fc=$fc ");
898901
} else { // use default 3 resolutions
899902
$destinationFile = self::preProcessHLS($destinationFile);
900903
}
@@ -908,6 +911,7 @@ private static function exec($format_id, $pathFileName, $destinationFile, $encod
908911
$code = replaceFFMPEG($code);
909912
$code = removeUserAgentIfNotURL($code);
910913
if (empty($code)) {
914+
_error_log("AVideo-Encoder Format::exec code is empty ");
911915
$obj->msg = "Code not found ($format_id, $pathFileName, $destinationFile, $encoder_queue_id)";
912916
} else {
913917
$obj->code = $code;

objects/HLSProcessor.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ public static function createHLSWithAudioTracks($pathFileName, $destinationFile)
2525

2626
if (file_exists($keyInfoFile)) {
2727
// Reuse existing keyinfo and key
28-
_error_log("HLSProcessor: Reusing existing key and keyinfo");
28+
_error_log("HLSProcessor: createHLSWithAudioTracks Reusing existing key and keyinfo");
2929
$keyFileName = basename(file($keyInfoFile)[0]); // Extract key filename from keyinfo
3030
} else {
3131
// Create encryption key
32-
_error_log("HLSProcessor: Creating new encryption key and keyinfo");
32+
_error_log("HLSProcessor: createHLSWithAudioTracks Creating new encryption key and keyinfo");
3333
$key = openssl_random_pseudo_bytes(16);
3434
$keyFileName = "enc_" . uniqid() . ".key";
3535
file_put_contents($destinationFile . $keyFileName, $key);
@@ -61,14 +61,15 @@ public static function createHLSWithAudioTracks($pathFileName, $destinationFile)
6161
"-hls_segment_filename \"{$audioTsPattern}\" {$audioFile}";
6262

6363
$audioCommand = removeUserAgentIfNotURL($audioCommand);
64-
_error_log("Executing audio FFmpeg command: {$audioCommand}");
64+
_error_log("HLSProcessor: createHLSWithAudioTracks Executing audio FFmpeg command: {$audioCommand}");
6565
exec($audioCommand, $output, $result_code); // Execute FFmpeg command
6666

6767
if (!file_exists($audioFile)) {
68-
_error_log("audioFile error: {$audioCommand} " . json_encode(array($output)));
68+
_error_log("HLSProcessor: createHLSWithAudioTracks audioFile error: {$audioCommand} " . json_encode(array($output)));
6969
rmdir("{$destinationFile}audio_tracks/{$langDir}");
7070
unset($audioTracks[$key]);
7171
} else {
72+
_error_log("HLSProcessor: createHLSWithAudioTracks audioFile Success" );
7273
// Add audio track entry to the master playlist
7374
$default = ($track->index == 0) ? "YES" : "NO"; // Set first audio track as default
7475
$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;
@@ -80,6 +81,7 @@ public static function createHLSWithAudioTracks($pathFileName, $destinationFile)
8081
// Generate HLS files for each resolution
8182
foreach ($resolutions as $key => $value) {
8283
if ($resolution >= $value) {
84+
_error_log("HLSProcessor: createHLSWithAudioTracks Resolution found: {$value}");
8385
$encodingSettings = Format::ENCODING_SETTINGS[$value];
8486
$rate = $encodingSettings['maxrate']; // Use the maxrate from ENCODING_SETTINGS
8587
$framerate = isset($videoFramerate[$key]) && $videoFramerate[$key] > 0 ? $videoFramerate[$key] : 30;
@@ -96,11 +98,12 @@ public static function createHLSWithAudioTracks($pathFileName, $destinationFile)
9698

9799
$resolutionsFound++;
98100
} else {
99-
_error_log("HLSProcessor: Skipped resolution {$value} for {$pathFileName} (video height is {$resolution})");
101+
_error_log("HLSProcessor: createHLSWithAudioTracks Skipped resolution {$value} for {$pathFileName} (video height is {$resolution})");
100102
}
101103
}
102104

103105
if (empty($resolutionsFound)) {
106+
_error_log("HLSProcessor: createHLSWithAudioTracks Resolution found is empty");
104107
// did not find any resolution, process the default one
105108
$encodingSettings = Format::ENCODING_SETTINGS[480];
106109
$rate = $encodingSettings['maxrate']; // Use the maxrate from ENCODING_SETTINGS
@@ -124,7 +127,7 @@ public static function createHLSWithAudioTracks($pathFileName, $destinationFile)
124127

125128
// Write the master playlist to the destination file
126129
file_put_contents($destinationFile . "index.m3u8", $masterPlaylist);
127-
_error_log("Master playlist written to: {$destinationFile}index.m3u8");
130+
_error_log("HLSProcessor: createHLSWithAudioTracks Master playlist written to: {$destinationFile}index.m3u8");
128131

129132
return array($destinationFile, $ffmpegCommand);
130133
}

0 commit comments

Comments
 (0)