Skip to content

A self-hosted media server and file management system

fix: subtitle extraction command is inefficient

aminnausin3bd5acc4c8e4
diff --git a/app/Services/Subtitles/SubtitleExtractor.php b/app/Services/Subtitles/SubtitleExtractor.php
index be4af549..dd98b58f 100644
--- a/app/Services/Subtitles/SubtitleExtractor.php
+++ b/app/Services/Subtitles/SubtitleExtractor.php
@@ -31,11 +31,15 @@ class SubtitleExtractor {
$commandStart = microtime(true);
$command = [
'ffmpeg',
- '-y',
+ '-y', // overwrite existing
'-i',
$mediaPath, // Media is on public disk for now does not need storage disk, path already has storage in it?
+ '-vn', // skip reading video
+ '-an', // skip reading audio
'-map',
- "0:$subtitle->track_id",
+ "0:$subtitle->track_id", // read the specific stream id
+ '-c:s',
+ 'copy', // don't re-encode
Storage::disk('local')->path($outputPath),
];
$timings['build_command'] = microtime(true) - $commandStart;