#!/usr/bin/python3 # Import the required libraries from os import listdir, system from os.path import isfile, join # Set the in and out folders InFolder="VideosIn" OutFolder="VideosOut" # Chose actions for subs, audio, and audio SubtitleAction = "copy" AudioAction = "libvorbis" VideoAction = "hevc_nvenc" # Make a list with all the files in the appropriate folder onlyfiles = [f for f in listdir(InFolder) if isfile(join(InFolder, f))] # Check file type and do the appropriate action for f in onlyfiles: InFilePath = "./" + InFolder + "/" + f OutFilePath = "./" + OutFolder + "/" + f if f[-4:] == ".mkv": print(f + " is an mkv file, transcoding...") # Transcode system("ffmpeg -loglevel 0 -i '" + InFilePath + "' -c:s " + SubtitleAction + " -c:a " + AudioAction + " -c:v " + VideoAction + " '" + OutFilePath + "'") # Print status message print("That was all the files.") # Thank the user print("Thank you for using my tool!")