@ -409,8 +409,8 @@ def streams(filename):
@click.option ( ' -dts ' , ' --dts-bitrate ' , type = int , default = DEFAULT_DTS_BANDWIDTH , help = f " Bitrate in kbit/s to be used to encode 6.1 audio streams (default: { DEFAULT_DTS_BANDWIDTH } ) " )
@click.option ( ' -dts ' , ' --dts-bitrate ' , type = int , default = DEFAULT_DTS_BANDWIDTH , help = f " Bitrate in kbit/s to be used to encode 6.1 audio streams (default: { DEFAULT_DTS_BANDWIDTH } ) " )
@click.option ( ' -ds ' , ' --default-subtitle ' , type = int , default = - 1 , help = ' Index of default subtitle stream ' )
@click.option ( ' -ds ' , ' --default-subtitle ' , type = int , default = - 1 , help = ' Index of default subtitle stream ' )
@click.option ( ' -fa ' , ' --forced-subtitle ' , type = int , default = - 1 , help = ' Index of forced subtitle stream ' ) # (including default audio stream tag)
@click.option ( ' -fa ' , ' --forced-audio ' , type = int , default = - 1 , help = ' Index of forced audio stream (including default audio stream tag) ' )
@click.option ( ' -da ' , ' --default-audio ' , type = int , default = - 1 , help = ' Index of default audio stream ' )
@click.option ( ' -da ' , ' --default-audio ' , type = int , default = - 1 , help = ' Index of default audio stream ' )
@ -427,7 +427,7 @@ def streams(filename):
@click.option ( " --dry-run " , is_flag = True , default = False )
@click.option ( " --dry-run " , is_flag = True , default = False )
def convert ( ctx , paths , label , video_encoder , quality , preset , stereo_bitrate , ac3_bitrate , dts_bitrate , default_subtitle , forced_ audio , default_audio , crop , output_directory , clear_metadata , denoise , no_jellyfin_tweaks , dry_run ) :
def convert ( ctx , paths , label , video_encoder , quality , preset , stereo_bitrate , ac3_bitrate , dts_bitrate , default_subtitle , forced_ subtitle , default_audio , crop , output_directory , clear_metadata , denoise , no_jellyfin_tweaks , dry_run ) :
""" Batch conversion of audiovideo files in format suitable for web playback, e.g. jellyfin
""" Batch conversion of audiovideo files in format suitable for web playback, e.g. jellyfin
Files found under PATHS will be converted according to parameters .
Files found under PATHS will be converted according to parameters .
@ -569,19 +569,30 @@ def convert(ctx, paths, label, video_encoder, quality, preset, stereo_bitrate, a
audioTokens = [ ]
audioTokens = [ ]
audioStreams = streamDescriptor [ STREAM_TYPE_AUDIO ]
subtitleStreams = streamDescriptor [ STREAM_TYPE_SUBTITLE ]
if default_audio == - 1 :
if default_audio == - 1 :
sourceAudioStreams = streamDescriptor[ STREAM_TYPE_AUDIO ]
sourceAudioStreams = audioStreams
else :
else :
sourceAudioStreams = getReorderedSubstreams ( streamDescriptor [ STREAM_TYPE_AUDIO ] , default_audio )
for streamIndex in range ( len ( audioStreams ) ) :
audioStreams [ streamIndex ] [ ' disposition ' ] [ ' default ' ] = 1 if streamIndex == default_audio else 0
sourceAudioStreams = getReorderedSubstreams ( audioStreams , default_audio )
dispositionTokens + = generateDispositionTokens ( sourceAudioStreams )
dispositionTokens + = generateDispositionTokens ( sourceAudioStreams )
if forced_subtitle != - 1 :
for streamIndex in range ( len ( subtitleStreams ) ) :
subtitleStreams [ streamIndex ] [ ' disposition ' ] [ ' forced ' ] = 1 if streamIndex == forced_subtitle else 0
if default_subtitle == - 1 :
if default_subtitle == - 1 :
sourceSubtitleStreams = streamDescriptor [ STREAM_TYPE_SUBTITLE ]
sourceSubtitleStreams = s ubtitleS treams
else :
else :
sourceSubtitleStreams = getReorderedSubstreams ( streamDescriptor [ STREAM_TYPE_SUBTITLE ] , default_subtitle )
for streamIndex in range ( len ( subtitleStreams ) ) :
subtitleStreams [ streamIndex ] [ ' disposition ' ] [ ' default ' ] = 1 if streamIndex == default_subtitle else 0
sourceSubtitleStreams = getReorderedSubstreams ( subtitleStreams , default_subtitle )
dispositionTokens + = generateDispositionTokens ( sourceSubtitleStreams )
dispositionTokens + = generateDispositionTokens ( sourceSubtitleStreams )
for audioStream in sourceAudioStreams :
for audioStream in sourceAudioStreams :
mappingTokens + = [ ' -map ' , f " a: { audioStream [ ' src_sub_index ' ] } " ]
mappingTokens + = [ ' -map ' , f " a: { audioStream [ ' src_sub_index ' ] } " ]
audioTokens + = generateAudioTokens ( context , audioStream [ ' src_sub_index ' ] , audioStream [ ' layout ' ] )
audioTokens + = generateAudioTokens ( context , audioStream [ ' src_sub_index ' ] , audioStream [ ' layout ' ] )