diff --git a/vid_convert.py b/vid_convert.py index 5436b11..76e8995 100755 --- a/vid_convert.py +++ b/vid_convert.py @@ -40,6 +40,7 @@ def get_infos(file): a_stream_infos = { 'index': a_stream['index'], 'channels': a_stream['channels'], + 'channel_layout': a_stream['channel_layout'], 'language': a_stream['tags']['language'], 'title': a_stream['tags']['title']} a_infos.append(a_stream_infos) @@ -121,6 +122,15 @@ def stabilization(file): subprocess.getoutput(cmd_stab) +def convert_audio(file, track, volume_adj, channels, channel_layout, language, title): + bitrate = 64*channels + codec = 'libopus' + metadatas = f'-metadata language="{language}" -metadata title="{title}"' + command = f'ffmpeg -i {file} -map 0:{track} -vn -sn -c:a {codec} -b:a {bitrate} -mapping_family 1 -filter:a volume={volume_adj}dB,aformat=channel_layouts={channel_layout} -y {file}_audio_{track}.mka' + logging.debug{command} + + + if __name__ == '__main__': import argparse parser = argparse.ArgumentParser() @@ -136,6 +146,6 @@ if __name__ == '__main__': interlaced = is_interlaced(args.f_input, infos) cropsize = cropping(args.f_input, infos) volumes = volume_audio(args.f_input, infos) - if args.stab: stabilization(args.f_input) + for