Adapted the code to transcode video & minor edits

Edited the gitignore for jetbarains
Edited the README to remove the version number
This commit is contained in:
Sebastian Hernø Gabrielli 2020-06-24 03:05:43 +02:00
parent f0ea408668
commit 28e88e77d0
3 changed files with 17 additions and 16 deletions

5
.gitignore vendored
View File

@ -1,2 +1,3 @@
ImagesIn
ImagesOut
VideosIn
VideosOut
.idea

View File

@ -1,4 +1,4 @@
# Mass video transcode 1.0
# Mass video transcode
This is a simple python tool to transcode multiple video files at once
## How to use

26
convert.py Normal file → Executable file
View File

@ -5,25 +5,25 @@ from os import listdir, system
from os.path import isfile, join
# Set the in and out folders
InFolder="ImagesIn"
OutFolder="ImagesOut"
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:
if f[-4:] == ".mp4":
print(f + " is an mp4 file, converting to GIF.")
# Convert to GIF
system("ffmpeg.exe -i \"" + InFolder + "\\" + f + "\" -nostats -loglevel 0 \"" + OutFolder + "\\" + f[:-4] + ".gif\"")
elif f[-5:] == ".webm":
print(f + " is a WebM file, converting to GIF.")
# Convert to GIF
system("ffmpeg.exe -i \"" + InFolder + "\\" + f + "\" -nostats -loglevel 0 \"" + OutFolder + "\\" + f[:-5] + ".gif\"")
else:
print(f + " is not an mp4 or WebM file, copying image.")
system("copy /V \"" + InFolder + "\\" + f + "\" \"" + OutFolder + "\\" + f + "\"")
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.")