From 797b6880ae17d249cb6b2c9ee5688c3092aa9d54 Mon Sep 17 00:00:00 2001 From: Seth Grover Date: Mon, 16 Sep 2024 11:15:42 -0600 Subject: [PATCH] for #36, ability to select audio stream with --audio-stream-index, and list audio tracks with --audio-stream-list --- src/cleanvid/cleanvid.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cleanvid/cleanvid.py b/src/cleanvid/cleanvid.py index 0fc476b..06643e1 100755 --- a/src/cleanvid/cleanvid.py +++ b/src/cleanvid/cleanvid.py @@ -595,17 +595,20 @@ def MultiplexCleanVideo(self): audioFilter = " " if self.embedSubs and os.path.isfile(self.cleanSubsFileSpec): outFileParts = os.path.splitext(self.outputVidFileSpec) - subsArgs = f" -i \"{self.cleanSubsFileSpec}\" -map 0 -map -0:s -map 1 -c:s {'mov_text' if outFileParts[1] == '.mp4' else 'srt'} -disposition:s:0 default -metadata:s:s:0 language={self.subsLang} " + subsArgsInput = f" -i \"{self.cleanSubsFileSpec}\" " + subsArgsEmbed = f" -map 1:s -c:s {'mov_text' if outFileParts[1] == '.mp4' else 'srt'} -disposition:s:0 default -metadata:s:s:0 language={self.subsLang} " else: - subsArgs = " -sn " + subsArgsInput = "" + subsArgsEmbed = " -sn " ffmpegCmd = ( f"ffmpeg -hide_banner -nostats -loglevel error -y {'' if self.threadsInput is None else ('-threads '+ str(int(self.threadsInput)))} -i \"" + self.inputVidFileSpec + "\"" + + subsArgsInput + audioFilter + f' -map 0:v -map "[a{audioStreamOnlyIndex}]" {audioUnchangedMapList} ' - + subsArgs + + subsArgsEmbed + videoArgs + f" {self.aParams} {'' if self.threadsEncoding is None else ('-threads '+ str(int(self.threadsEncoding)))} \"" + self.outputVidFileSpec