diff --git a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs
index 4bfed2d..13815b7 100644
--- a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs
+++ b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs
@@ -17,7 +17,7 @@ namespace N_m3u8DL_RE.CommandLine;
internal static partial class CommandInvoker
{
- public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20241216";
+ public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20250311";
[GeneratedRegex("((best|worst)\\d*|all)")]
private static partial Regex ForStrRegex();
diff --git a/src/N_m3u8DL-RE/Config/EnvConfigKey.cs b/src/N_m3u8DL-RE/Config/EnvConfigKey.cs
new file mode 100644
index 0000000..c71ce94
--- /dev/null
+++ b/src/N_m3u8DL-RE/Config/EnvConfigKey.cs
@@ -0,0 +1,22 @@
+namespace N_m3u8DL_RE.Config;
+
+///
+/// 通过配置环境变量来实现更细节地控制某些逻辑
+///
+public static class EnvConfigKey
+{
+ ///
+ /// 当此值为1时, 在图形字幕处理逻辑中PNG生成后不再删除m4s文件
+ ///
+ public const string ReKeepImageSegments = "RE_KEEP_IMAGE_SEGMENTS";
+
+ ///
+ /// 控制启用PipeMux时, 具体ffmpeg命令行
+ ///
+ public const string ReLivePipeOptions = "RE_LIVE_PIPE_OPTIONS";
+
+ ///
+ /// 控制启用PipeMux时, 非Windows环境下命名管道文件的生成目录
+ ///
+ public const string ReLivePipeTmpDir = "RE_LIVE_PIPE_TMP_DIR";
+}
\ No newline at end of file
diff --git a/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs b/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs
index b9333eb..f4bbb8b 100644
--- a/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs
+++ b/src/N_m3u8DL-RE/DownloadManager/SimpleDownloadManager.cs
@@ -454,7 +454,9 @@ internal class SimpleDownloadManager
// 处理图形字幕
await SubtitleUtil.TryWriteImagePngsAsync(finalVtt, tmpDir);
- foreach (var item in files) File.Delete(item);
+ var keepSegments = OtherUtil.GetEnvironmentVariable(EnvConfigKey.ReKeepImageSegments);
+ if (keepSegments != "1")
+ foreach (var item in files) File.Delete(item);
FileDic.Clear();
var index = 0;
var path = Path.Combine(tmpDir, index.ToString(pad) + ".fix.vtt");
@@ -506,7 +508,9 @@ internal class SimpleDownloadManager
// 处理图形字幕
await SubtitleUtil.TryWriteImagePngsAsync(finalVtt, tmpDir);
- foreach (var item in files) File.Delete(item);
+ var keepSegments = OtherUtil.GetEnvironmentVariable(EnvConfigKey.ReKeepImageSegments);
+ if (keepSegments != "1")
+ foreach (var item in files) File.Delete(item);
FileDic.Clear();
var index = 0;
var path = Path.Combine(tmpDir, index.ToString(pad) + ".fix.vtt");
diff --git a/src/N_m3u8DL-RE/Util/PipeUtil.cs b/src/N_m3u8DL-RE/Util/PipeUtil.cs
index 65a988f..06d119b 100644
--- a/src/N_m3u8DL-RE/Util/PipeUtil.cs
+++ b/src/N_m3u8DL-RE/Util/PipeUtil.cs
@@ -3,6 +3,7 @@ using Spectre.Console;
using System.Diagnostics;
using System.IO.Pipes;
using System.Text;
+using N_m3u8DL_RE.Config;
namespace N_m3u8DL_RE.Util;
@@ -43,11 +44,11 @@ internal static class PipeUtil
public static bool StartPipeMux(string binary, string[] pipeNames, string outputPath)
{
- string dateString = DateTime.Now.ToString("o");
- StringBuilder command = new StringBuilder("-y -fflags +genpts -loglevel quiet ");
+ var dateString = DateTime.Now.ToString("o");
+ var command = new StringBuilder("-y -fflags +genpts -loglevel quiet ");
- string customDest = OtherUtil.GetEnvironmentVariable("RE_LIVE_PIPE_OPTIONS");
- string pipeDir = OtherUtil.GetEnvironmentVariable("RE_LIVE_PIPE_TMP_DIR", Path.GetTempPath());
+ var customDest = OtherUtil.GetEnvironmentVariable(EnvConfigKey.ReLivePipeOptions);
+ var pipeDir = OtherUtil.GetEnvironmentVariable(EnvConfigKey.ReLivePipeTmpDir, Path.GetTempPath());
if (!string.IsNullOrEmpty(customDest))
{
@@ -63,7 +64,7 @@ internal static class PipeUtil
command.Append($" -i \"{Path.Combine(pipeDir, item)}\" ");
}
- for (int i = 0; i < pipeNames.Length; i++)
+ for (var i = 0; i < pipeNames.Length; i++)
{
command.Append($" -map {i} ");
}