Skip to content

Instantly share code, notes, and snippets.

@lambdan
Created January 25, 2022 15:52
Show Gist options
  • Save lambdan/50be89d8129c9632053c20fab0d6050a to your computer and use it in GitHub Desktop.
Save lambdan/50be89d8129c9632053c20fab0d6050a to your computer and use it in GitHub Desktop.
convert videos with mp3 audio to aac
# remove .exe's to make it unix compatible
# needs mediainfo and ffmpeg
import os, subprocess
path = "Z:/Videos"
for f in os.listdir(path):
mi = subprocess.check_output(["mediainfo.exe", os.path.join(path,f)])
if "MPEG Audio" in str(mi):
print(f, "= mp3")
cmd = ["ffmpeg.exe", "-hide_banner", "-i", os.path.join(path,f), "-c:v", "copy", "-c:a", "aac", "fixed/" + f]
subprocess.call(cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment