Skip to content

The only downloader you need. 下载器的集大成者。

fix(m3u8): fMP4 直播停止录制后无法保存 #1137

XiaoYouChRbd533a9a01af
diff --git a/features/m3u8_pack/config.py b/features/m3u8_pack/config.py
index 82051d64..d211df9d 100644
--- a/features/m3u8_pack/config.py
+++ b/features/m3u8_pack/config.py
@@ -45,7 +45,6 @@ class M3U8Config(PackConfig):
shouldBinaryMerge = ConfigItem("M3U8", "BinaryMerge", False, BoolValidator())
shouldCheckSegmentsCount = ConfigItem("M3U8", "CheckSegmentsCount", True, BoolValidator())
shouldKeepLiveSegments = ConfigItem("M3U8", "LiveKeepSegments", False, BoolValidator())
- shouldUseLivePipeMux = ConfigItem("M3U8", "LivePipeMux", False, BoolValidator())
shouldFixLiveVtt = ConfigItem("M3U8", "LiveFixVtt", False, BoolValidator())
liveWaitTime = RangeConfigItem("M3U8", "LiveWaitTime", 0, RangeValidator(0, 100000))
liveTakeCount = RangeConfigItem("M3U8", "LiveTakeCount", 0, RangeValidator(0, 1000))
@@ -102,8 +101,6 @@ class M3U8Config(PackConfig):
self.tr("下载完成后检查实际分片数是否与预期一致"), self.shouldCheckSegmentsCount, m3u8Group),
SwitchSettingCard(FluentIcon.SAVE, self.tr("直播保留原始分片"),
self.tr("实时合并录制时仍保留下载的原始分片"), self.shouldKeepLiveSegments, m3u8Group),
- SwitchSettingCard(FluentIcon.CODE, self.tr("直播管道混流"),
- self.tr("录制时通过管道交给 ffmpeg 实时混流为封装容器"), self.shouldUseLivePipeMux, m3u8Group),
SwitchSettingCard(FluentIcon.FONT, self.tr("直播校正 VTT 字幕"),
self.tr("根据音频起始时间校正 VTT 字幕时间轴"), self.shouldFixLiveVtt, m3u8Group),
SpinBoxSettingCard(FluentIcon.STOP_WATCH, self.tr("直播刷新等待时间"),
diff --git a/features/m3u8_pack/pack.py b/features/m3u8_pack/pack.py
index 97e8638f..9b3f783f 100644
--- a/features/m3u8_pack/pack.py
+++ b/features/m3u8_pack/pack.py
@@ -192,7 +192,6 @@ class M3U8Parser(TaskParser):
shouldBinaryMerge=m3u8Config.shouldBinaryMerge.value,
shouldCheckSegmentsCount=m3u8Config.shouldCheckSegmentsCount.value,
shouldDeleteTemp=m3u8Config.shouldDeleteTemp.value,
- outputFormat=m3u8Config.outputFormat.value,
customMuxAfterDone=m3u8Config.customMuxAfterDone.value,
subtitleFormat=m3u8Config.subtitleFormat.value,
shouldSelectAllAudioSubtitle=m3u8Config.shouldSelectAllAudioSubtitle.value,
@@ -205,7 +204,6 @@ class M3U8Parser(TaskParser):
decryptionBinaryPath=m3u8Config.decryptionBinaryPath.value,
shouldUseMp4RealTimeDecryption=m3u8Config.shouldUseMp4RealTimeDecryption.value,
shouldKeepLiveSegments=m3u8Config.shouldKeepLiveSegments.value,
- shouldUseLivePipeMux=m3u8Config.shouldUseLivePipeMux.value,
shouldFixLiveVtt=m3u8Config.shouldFixLiveVtt.value,
liveWaitTime=m3u8Config.liveWaitTime.value,
liveTakeCount=m3u8Config.liveTakeCount.value,
diff --git a/features/m3u8_pack/task.py b/features/m3u8_pack/task.py
index cc4895e4..7103c221 100644
--- a/features/m3u8_pack/task.py
+++ b/features/m3u8_pack/task.py
@@ -171,7 +171,6 @@ class M3U8TaskStep(TaskStep):
shouldBinaryMerge: bool = False
shouldCheckSegmentsCount: bool = True
shouldDeleteTemp: bool = True
- outputFormat: str = "mp4"
customMuxAfterDone: str = ""
subtitleFormat: str = "SRT"
selectVideo: str = ""
@@ -188,7 +187,6 @@ class M3U8TaskStep(TaskStep):
decryptionKeyFile: str = ""
muxImports: list[str] = field(default_factory=list)
shouldKeepLiveSegments: bool = False
- shouldUseLivePipeMux: bool = False
shouldFixLiveVtt: bool = False
liveWaitTime: int = 0
liveTakeCount: int = 0
@@ -269,7 +267,8 @@ class M3U8TaskStep(TaskStep):
if self.task.isLive:
args.append("--live-real-time-merge=true")
args.append(f"--live-keep-segments={toBool(self.shouldKeepLiveSegments)}")
- args.append(f"--live-pipe-mux={toBool(self.shouldUseLivePipeMux)}")
+ # Without pipe mux the container follows the segment format and can differ from the Name.
+ args.append("--live-pipe-mux=true")
if self.shouldFixLiveVtt:
args.append("--live-fix-vtt-by-audio=true")
if self.liveWaitTime > 0:
@@ -283,7 +282,7 @@ class M3U8TaskStep(TaskStep):
else:
from ffmpeg_pack.config import ffmpegRuntime
ffmpegPath = ffmpegRuntime.path()
- muxOption = f"format={self.outputFormat}:muxer=ffmpeg"
+ muxOption = f"format={Path(self.task.name).suffix.lstrip('.').lower()}:muxer=ffmpeg"
if ffmpegPath:
muxOption += f":bin_path={ffmpegPath}"
args.append(f"--mux-after-done={muxOption}")