only use -map for audio if needed
This commit is contained in:
parent
16d10e1c3f
commit
cad911a807
1 changed files with 4 additions and 4 deletions
|
@ -66,7 +66,7 @@ def supported_formats():
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def stream(video, target, profile, info, audio_track=0, flags={}):
|
def stream(video, target, profile, info, audio_track=None, flags={}):
|
||||||
if not os.path.exists(target):
|
if not os.path.exists(target):
|
||||||
ox.makedirs(os.path.dirname(target))
|
ox.makedirs(os.path.dirname(target))
|
||||||
|
|
||||||
|
@ -253,8 +253,7 @@ def stream(video, target, profile, info, audio_track=0, flags={}):
|
||||||
n = 1
|
n = 1
|
||||||
audio_settings = []
|
audio_settings = []
|
||||||
# mix 2 mono channels into stereo(common for fcp dv mov files)
|
# mix 2 mono channels into stereo(common for fcp dv mov files)
|
||||||
audio_map = []
|
if audio_track is None and len(info['audio']) == 2 \
|
||||||
if audio_track == 0 and len(info['audio']) == 2 \
|
|
||||||
and len(filter(None, [a['channels'] == 1 or None for a in info['audio']])) == 2:
|
and len(filter(None, [a['channels'] == 1 or None for a in info['audio']])) == 2:
|
||||||
audio_settings += [
|
audio_settings += [
|
||||||
'-filter_complex',
|
'-filter_complex',
|
||||||
|
@ -262,8 +261,9 @@ def stream(video, target, profile, info, audio_track=0, flags={}):
|
||||||
]
|
]
|
||||||
mono_mix = True
|
mono_mix = True
|
||||||
else:
|
else:
|
||||||
audio_settings += ['-map', '0:%s,0:%s' % (info['audio'][audio_track]['id'], n)]
|
|
||||||
mono_mix = False
|
mono_mix = False
|
||||||
|
if audio_track is not None:
|
||||||
|
audio_settings += ['-map', '0:%s,0:%s' % (info['audio'][audio_track]['id'], n)]
|
||||||
audio_settings += ['-ar', str(audiorate)]
|
audio_settings += ['-ar', str(audiorate)]
|
||||||
if audio_codec != 'libopus':
|
if audio_codec != 'libopus':
|
||||||
audio_settings += ['-aq', str(audioquality)]
|
audio_settings += ['-aq', str(audioquality)]
|
||||||
|
|
Loading…
Reference in a new issue