Skip to content

Instantly share code, notes, and snippets.

@alrafiabdullah
Created April 5, 2021 11:44
Show Gist options
  • Save alrafiabdullah/98695d9a60ef75a51d23deb1c5ea40b2 to your computer and use it in GitHub Desktop.
Save alrafiabdullah/98695d9a60ef75a51d23deb1c5ea40b2 to your computer and use it in GitHub Desktop.
for mkv in mkv_list:
name, ext = os.path.splitext(mkv)
if ext != ".mkv":
raise Exception("Please add MKV files only!")
output_name = name + ".mp4"
try:
subprocess.run(
["ffmpeg", "-i", f"assets/{mkv}", "-codec", "copy", f"result/{output_name}"], check=True
)
except:
raise Exception(
"Please DOWNLOAD, INSTALL & ADD the path of FFMPEG to Environment Variables!"
)
print(f"{len(mkv_list)} video(s) converted to MP4!")
os.startfile("result")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment