unknown audio
This commit is contained in:
60
bin/ffx.py
60
bin/ffx.py
@@ -48,7 +48,7 @@ def generateOutputTokens(f, q=''):
|
||||
if q:
|
||||
fTokens = f.split('.')
|
||||
paddedFilename = '.'.join(fTokens[:-1]) + f" q{q}" + '.' + fTokens[-1]
|
||||
return ['-f', 'webm', paddedFilename]
|
||||
return ['-f', 'webm', paddedFilename]
|
||||
else:
|
||||
return ['-f', 'webm', f]
|
||||
|
||||
@@ -116,7 +116,10 @@ audioStreams = [s for s in streamData if s['codec_type'] == 'audio']
|
||||
subtitleStreams = [s for s in streamData if s['codec_type'] == 'subtitle']
|
||||
|
||||
for aStream in audioStreams:
|
||||
print(f"audio stream: {aStream['channel_layout']}")
|
||||
if 'channel_layout' in aStream.keys():
|
||||
print(f"audio stream: {aStream['channel_layout']}") #channel_layout
|
||||
else:
|
||||
print(f"unknown audio stream with {aStream['channels']} channels") #channel_layout
|
||||
|
||||
commandTokens = ['ffmpeg', '-y', '-i', inputFilename]
|
||||
|
||||
@@ -133,29 +136,42 @@ for s in range(len(subtitleStreams)):
|
||||
audioTokens = []
|
||||
audioStreamIndex = 0
|
||||
for aStream in audioStreams:
|
||||
channelLayout = aStream['channel_layout']
|
||||
|
||||
if channelLayout == '6.1':
|
||||
audioTokens += [f"-c:a:{audioStreamIndex}",
|
||||
'libopus',
|
||||
f"-filter:a:{audioStreamIndex}",
|
||||
'channelmap=channel_layout=6.1',
|
||||
f"-b:a:{audioStreamIndex}",
|
||||
dtsBandwidth]
|
||||
channels = aStream['channels']
|
||||
|
||||
if channelLayout == '5.1(side)':
|
||||
audioTokens += [f"-c:a:{audioStreamIndex}",
|
||||
'libopus',
|
||||
f"-filter:a:{audioStreamIndex}",
|
||||
"channelmap=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:5.1",
|
||||
f"-b:a:{audioStreamIndex}",
|
||||
ac3Bandwidth]
|
||||
if 'channel_layout' in aStream.keys():
|
||||
|
||||
channelLayout = aStream['channel_layout']
|
||||
|
||||
if channelLayout == '6.1':
|
||||
audioTokens += [f"-c:a:{audioStreamIndex}",
|
||||
'libopus',
|
||||
f"-filter:a:{audioStreamIndex}",
|
||||
'channelmap=channel_layout=6.1',
|
||||
f"-b:a:{audioStreamIndex}",
|
||||
dtsBandwidth]
|
||||
|
||||
if channelLayout == '5.1(side)':
|
||||
audioTokens += [f"-c:a:{audioStreamIndex}",
|
||||
'libopus',
|
||||
f"-filter:a:{audioStreamIndex}",
|
||||
"channelmap=FL-FL|FR-FR|FC-FC|LFE-LFE|SL-BL|SR-BR:5.1",
|
||||
f"-b:a:{audioStreamIndex}",
|
||||
ac3Bandwidth]
|
||||
|
||||
if channelLayout == 'stereo':
|
||||
audioTokens += [f"-c:a:{audioStreamIndex}",
|
||||
'libopus',
|
||||
f"-b:a:{audioStreamIndex}",
|
||||
stereoBandwidth]
|
||||
else:
|
||||
|
||||
if channels == 6:
|
||||
audioTokens += [f"-c:a:{audioStreamIndex}",
|
||||
'libopus',
|
||||
f"-b:a:{audioStreamIndex}",
|
||||
ac3Bandwidth]
|
||||
|
||||
if channelLayout == 'stereo':
|
||||
audioTokens += [f"-c:a:{audioStreamIndex}",
|
||||
'libopus',
|
||||
f"-b:a:{audioStreamIndex}",
|
||||
stereoBandwidth]
|
||||
|
||||
audioStreamIndex += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user