@@ -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