Update Saqel Platform: 2026-09-09 00:12:31
This commit is contained in:
@@ -267,8 +267,15 @@ class VideoService
|
||||
@shell_exec($thumbCmd);
|
||||
|
||||
// 2. Generate HLS Segments & Playlist (6-second chunks for fast start)
|
||||
$hlsCmd = "{$ffmpeg} -i " . escapeshellarg($sourceMp4Path) . " -codec:v libx264 -crf 23 -preset veryfast -codec:a aac -b:a 128k -hls_time 6 -hls_list_size 0 -hls_segment_filename " . escapeshellarg($segmentPattern) . " " . escapeshellarg($playlistPath) . " -y 2>/dev/null";
|
||||
@shell_exec($hlsCmd);
|
||||
// Try ultra-fast stream copy first (takes 2-4s instead of 4 minutes of CPU encoding)
|
||||
$hlsFastCmd = "{$ffmpeg} -i " . escapeshellarg($sourceMp4Path) . " -c copy -hls_time 6 -hls_list_size 0 -hls_segment_filename " . escapeshellarg($segmentPattern) . " " . escapeshellarg($playlistPath) . " -y 2>/dev/null";
|
||||
@shell_exec($hlsFastCmd);
|
||||
|
||||
// Fallback to transcoding only if stream copy failed to produce playlist
|
||||
if (!file_exists($playlistPath)) {
|
||||
$hlsCmd = "{$ffmpeg} -i " . escapeshellarg($sourceMp4Path) . " -codec:v libx264 -crf 23 -preset veryfast -codec:a aac -b:a 128k -hls_time 6 -hls_list_size 0 -hls_segment_filename " . escapeshellarg($segmentPattern) . " " . escapeshellarg($playlistPath) . " -y 2>/dev/null";
|
||||
@shell_exec($hlsCmd);
|
||||
}
|
||||
|
||||
$hlsUrl = '/api/videos/hls/' . $videoUuid . '/index.m3u8';
|
||||
$thumbUrl = '/api/videos/hls/' . $videoUuid . '/thumbnail.jpg';
|
||||
|
||||
Reference in New Issue
Block a user