Guest User

Simple script to remerge soundfiles

a guest
Nov 26th, 2022
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. import subprocess, shlex, re
  2.  
  3. if __name__ == '__main__':
  4.     file = input("Filename:").replace('"','')
  5.     info = re.search(r'(.+)\[sound=(\S+\.(\S+))\]', file, flags=re.I)
  6.     original_name = info.group(1).strip()
  7.     url = info.group(2).replace("%2F","/").replace("%3A",":")
  8.     if not re.match("http", url):
  9.         url = "https://" + url
  10.     sound_ext = info.group(3)
  11.     if sound_ext in ['ogg', 'opus', 'webm']:
  12.         a_codec = "copy"
  13.     else:
  14.         a_codec = "libopus"
  15.     subprocess.run(shlex.split(r'ffmpeg.exe -i "' + file + r'" -i "' + url + r'" -c:v copy -c:a ' + a_codec + r' -y "' + original_name + r'.webm"'))
Add Comment
Please, Sign In to add comment