mass-video-transcode/convert.py
Sebastian Hernø Gabrielli 28e88e77d0 Adapted the code to transcode video & minor edits
Edited the gitignore for jetbarains
Edited the README to remove the version number
2020-06-24 03:05:43 +02:00

33 lines
970 B
Python
Executable File

#!/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!")