Skip to content

Commit

Permalink
for #36, ability to select audio stream with --audio-stream-index, an…
Browse files Browse the repository at this point in the history
…d list audio tracks with --audio-stream-list
  • Loading branch information
mmguero committed Sep 16, 2024
1 parent 755f40f commit 797b688
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/cleanvid/cleanvid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 797b688

Please sign in to comment.