5
0

yt_common: audio: allow stream configuration

This commit is contained in:
louis f 2021-06-05 23:11:15 -04:00
parent ef1c61d966
commit 8fcdf12cd3
Signed by: louis
GPG Key ID: 44D7E1DE4E23D6F2

View File

@ -187,6 +187,7 @@ class SelfRunner():
self.audio_file = out_name self.audio_file = out_name
def _do_mux(self, name: str, chapters: bool = True) -> int: def _do_mux(self, name: str, chapters: bool = True) -> int:
streams = self.src.audio_streams()
tcargs = ["--timecodes", f"0:{self.timecode_file}"] if self.timecode_file else [] tcargs = ["--timecodes", f"0:{self.timecode_file}"] if self.timecode_file else []
mkvtoolnix_args = [ mkvtoolnix_args = [
"mkvmerge", "mkvmerge",
@ -195,10 +196,12 @@ class SelfRunner():
"--default-track", "0:yes", "--default-track", "0:yes",
] + tcargs + [ ] + tcargs + [
"(", self.video_file, ")", "(", self.video_file, ")",
"--no-chapters", "--no-track-tags", "--no-global-tags", "--track-name", "0:", "--no-chapters", "--no-track-tags", "--no-global-tags",
"--default-track", "0:yes", "--language", "0:jpn", ] + [y for i, s in enumerate(streams) for y in ("--track-name", f"{i:d}:{s.name}",
"--default-track", f"{i:d}:yes" if i == 0 else f"{i:d}:no",
"--language", f"{i:d}:{s.language}")] + [
"(", self.audio_file, ")", "(", self.audio_file, ")",
"--track-order", "0:0,0:1", "--track-order", "0:0,"+",".join([f"1:{i:d}" for i in range(len(streams))])
] ]
if chapters: if chapters:
chap = [f for f in [f"{self.config.desc}.xml", "chapters.xml"] if os.path.isfile(f)] chap = [f for f in [f"{self.config.desc}.xml", "chapters.xml"] if os.path.isfile(f)]