Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess, shlex, re
- if __name__ == '__main__':
- file = input("Filename:").replace('"','')
- info = re.search(r'(.+)\[sound=(\S+\.(\S+))\]\.(\S+)', file, flags=re.I)
- original_name = info.group(1).strip()
- url = info.group(2).replace("%2F","/").replace("%3A",":")
- if not re.match("http", url):
- url = "https://" + url
- sound_ext = info.group(3)
- video_ext = info.group(4)
- a_codec = "copy" if sound_ext in ['ogg', 'opus', 'webm'] else "libopus"
- v_codec = "copy" if video_ext == 'webm' else "libvpx-vp9 -pix_fmt yuv420p"
- subprocess.run(shlex.split(r'ffmpeg.exe -i "' + file + r'" -i "' + url + r'" -c:v ' + v_codec + r' -c:a ' + a_codec + r' -y "' + original_name + r'.webm"'))
Add Comment
Please, Sign In to add comment