|
|
@ -5,7 +5,7 @@ from ffx.helper import DIFF_ADDED_KEY, DIFF_REMOVED_KEY, DIFF_CHANGED_KEY
|
|
|
|
from ffx.track_descriptor import TrackDescriptor
|
|
|
|
from ffx.track_descriptor import TrackDescriptor
|
|
|
|
from ffx.model.track import Track
|
|
|
|
from ffx.model.track import Track
|
|
|
|
from ffx.audio_layout import AudioLayout
|
|
|
|
from ffx.audio_layout import AudioLayout
|
|
|
|
|
|
|
|
from ffx.track_type import TrackType
|
|
|
|
|
|
|
|
|
|
|
|
class FfxController():
|
|
|
|
class FfxController():
|
|
|
|
|
|
|
|
|
|
|
@ -104,41 +104,59 @@ class FfxController():
|
|
|
|
return ['-f', format, f"{filepath}.{ext}"]
|
|
|
|
return ['-f', format, f"{filepath}.{ext}"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generateAudioEncodingTokens(self, subIndex : int, layout : AudioLayout):
|
|
|
|
def generateAudioEncodingTokens(self):
|
|
|
|
"""Generates ffmpeg options for one output audio stream including channel remapping, codec and bitrate"""
|
|
|
|
"""Generates ffmpeg options audio streams including channel remapping, codec and bitrate"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
audioTokens = []
|
|
|
|
if layout == AudioLayout.LAYOUT_6_1:
|
|
|
|
|
|
|
|
return [f"-c:a:{subIndex}",
|
|
|
|
#sourceAudioTrackDescriptors = [smd for smd in self.__sourceMediaDescriptor.getAllTrackDescriptors() if smd.getType() == TrackType.AUDIO]
|
|
|
|
'libopus',
|
|
|
|
targetAudioTrackDescriptors = [rtd for rtd in self.__targetMediaDescriptor.getReorderedTrackDescriptors() if rtd.getType() == TrackType.AUDIO]
|
|
|
|
f"-filter:a:{subIndex}",
|
|
|
|
|
|
|
|
'channelmap=channel_layout=6.1',
|
|
|
|
trackSubIndex = 0
|
|
|
|
f"-b:a:{subIndex}",
|
|
|
|
for trackDescriptor in targetAudioTrackDescriptors:
|
|
|
|
self.__context['bitrates']['dts']]
|
|
|
|
|
|
|
|
|
|
|
|
# Calculate source sub index
|
|
|
|
elif layout == AudioLayout.LAYOUT_5_1:
|
|
|
|
#changedTargetTrackDescriptor : TrackDescriptor = targetAudioTrackDescriptors[trackDescriptor.getIndex()]
|
|
|
|
return [f"-c:a:{subIndex}",
|
|
|
|
#changedTargetTrackSourceIndex = changedTargetTrackDescriptor.getSourceIndex()
|
|
|
|
'libopus',
|
|
|
|
#sourceSubIndex = sourceAudioTrackDescriptors[changedTargetTrackSourceIndex].getSubIndex()
|
|
|
|
f"-filter:a:{subIndex}",
|
|
|
|
|
|
|
|
"channelmap=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:5.1",
|
|
|
|
trackAudioLayout = trackDescriptor.getAudioLayout()
|
|
|
|
f"-b:a:{subIndex}",
|
|
|
|
|
|
|
|
self.__context['bitrates']['ac3']]
|
|
|
|
#TODO: Sollte nicht die sub index unverändert bleiben wenn jellyfin reordering angewendet wurde?
|
|
|
|
|
|
|
|
# siehe auch: MediaDescriptor.getInputMappingTokens()
|
|
|
|
elif layout == AudioLayout.LAYOUT_STEREO:
|
|
|
|
#trackSubIndex = trackDescriptor.getSubIndex()
|
|
|
|
return [f"-c:a:{subIndex}",
|
|
|
|
|
|
|
|
'libopus',
|
|
|
|
if trackAudioLayout == AudioLayout.LAYOUT_6_1:
|
|
|
|
f"-b:a:{subIndex}",
|
|
|
|
audioTokens += [f"-c:a:{trackSubIndex}",
|
|
|
|
self.__context['bitrates']['stereo']]
|
|
|
|
'libopus',
|
|
|
|
|
|
|
|
f"-filter:a:{trackSubIndex}",
|
|
|
|
elif layout == AudioLayout.LAYOUT_6CH:
|
|
|
|
'channelmap=channel_layout=6.1',
|
|
|
|
return [f"-c:a:{subIndex}",
|
|
|
|
f"-b:a:{trackSubIndex}",
|
|
|
|
'libopus',
|
|
|
|
self.__context['bitrates']['dts']]
|
|
|
|
f"-filter:a:{subIndex}",
|
|
|
|
|
|
|
|
"channelmap=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:5.1",
|
|
|
|
if trackAudioLayout == AudioLayout.LAYOUT_5_1:
|
|
|
|
f"-b:a:{subIndex}",
|
|
|
|
audioTokens += [f"-c:a:{trackSubIndex}",
|
|
|
|
self.__context['bitrates']['ac3']]
|
|
|
|
'libopus',
|
|
|
|
else:
|
|
|
|
f"-filter:a:{trackSubIndex}",
|
|
|
|
return []
|
|
|
|
"channelmap=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:5.1",
|
|
|
|
|
|
|
|
f"-b:a:{trackSubIndex}",
|
|
|
|
|
|
|
|
self.__context['bitrates']['ac3']]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if trackAudioLayout == AudioLayout.LAYOUT_STEREO:
|
|
|
|
|
|
|
|
audioTokens += [f"-c:a:{trackSubIndex}",
|
|
|
|
|
|
|
|
'libopus',
|
|
|
|
|
|
|
|
f"-b:a:{trackSubIndex}",
|
|
|
|
|
|
|
|
self.__context['bitrates']['stereo']]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if trackAudioLayout == AudioLayout.LAYOUT_6CH:
|
|
|
|
|
|
|
|
audioTokens += [f"-c:a:{trackSubIndex}",
|
|
|
|
|
|
|
|
'libopus',
|
|
|
|
|
|
|
|
f"-filter:a:{trackSubIndex}",
|
|
|
|
|
|
|
|
"channelmap=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:5.1",
|
|
|
|
|
|
|
|
f"-b:a:{trackSubIndex}",
|
|
|
|
|
|
|
|
self.__context['bitrates']['ac3']]
|
|
|
|
|
|
|
|
trackSubIndex += 1
|
|
|
|
|
|
|
|
return audioTokens
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def generateClearTokens(self, streams):
|
|
|
|
# def generateClearTokens(self, streams):
|
|
|
|