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:
parent
f0ea408668
commit
28e88e77d0
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
ImagesIn
|
VideosIn
|
||||||
ImagesOut
|
VideosOut
|
||||||
|
.idea
|
||||||
|
|||||||
@ -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
|
This is a simple python tool to transcode multiple video files at once
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|||||||
26
convert.py
Normal file → Executable file
26
convert.py
Normal file → Executable file
@ -5,25 +5,25 @@ from os import listdir, system
|
|||||||
from os.path import isfile, join
|
from os.path import isfile, join
|
||||||
|
|
||||||
# Set the in and out folders
|
# Set the in and out folders
|
||||||
InFolder="ImagesIn"
|
InFolder="VideosIn"
|
||||||
OutFolder="ImagesOut"
|
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
|
# Make a list with all the files in the appropriate folder
|
||||||
onlyfiles = [f for f in listdir(InFolder) if isfile(join(InFolder, f))]
|
onlyfiles = [f for f in listdir(InFolder) if isfile(join(InFolder, f))]
|
||||||
|
|
||||||
# Check file type and do the appropriate action
|
# Check file type and do the appropriate action
|
||||||
for f in onlyfiles:
|
for f in onlyfiles:
|
||||||
if f[-4:] == ".mp4":
|
InFilePath = "./" + InFolder + "/" + f
|
||||||
print(f + " is an mp4 file, converting to GIF.")
|
OutFilePath = "./" + OutFolder + "/" + f
|
||||||
# Convert to GIF
|
if f[-4:] == ".mkv":
|
||||||
system("ffmpeg.exe -i \"" + InFolder + "\\" + f + "\" -nostats -loglevel 0 \"" + OutFolder + "\\" + f[:-4] + ".gif\"")
|
print(f + " is an mkv file, transcoding...")
|
||||||
elif f[-5:] == ".webm":
|
# Transcode
|
||||||
print(f + " is a WebM file, converting to GIF.")
|
system("ffmpeg -loglevel 0 -i '" + InFilePath + "' -c:s " + SubtitleAction + " -c:a " + AudioAction + " -c:v " + VideoAction + " '" + OutFilePath + "'")
|
||||||
# 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 + "\"")
|
|
||||||
|
|
||||||
# Print status message
|
# Print status message
|
||||||
print("That was all the files.")
|
print("That was all the files.")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user