Added support for more files
This commit is contained in:
parent
05269f3284
commit
1fbb682faf
18
convert.py
18
convert.py
@ -21,6 +21,7 @@ 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:
|
||||||
InFilePath = "./" + InFolder + "/" + f
|
InFilePath = "./" + InFolder + "/" + f
|
||||||
|
print("file: " + InFilePath)
|
||||||
|
|
||||||
# Video
|
# Video
|
||||||
if f[-4:] == ".mkv" or f[-4:] == ".mp4":
|
if f[-4:] == ".mkv" or f[-4:] == ".mp4":
|
||||||
@ -38,13 +39,26 @@ for f in onlyfiles:
|
|||||||
print(f + " is a " + f[-4:] + " file, converting...")
|
print(f + " is a " + f[-4:] + " file, converting...")
|
||||||
OutFilePath = "./" + OutFolder + "/" + f[:-5] + ".ogg"
|
OutFilePath = "./" + OutFolder + "/" + f[:-5] + ".ogg"
|
||||||
# Transcode
|
# Transcode
|
||||||
system("ffmpeg -loglevel 0 -i \"" + InFilePath + "\" -c:a " + AudioAction + " \"" + OutFilePath + "\" && rm \"" + InFilePath + "\"")
|
system("ffmpeg -loglevel 0 -vn -i \"" + InFilePath + "\" -c:a " + AudioAction + " \"" + OutFilePath + "\" && rm \"" + InFilePath + "\"")
|
||||||
|
|
||||||
if f[-4:] == ".m4a":
|
if f[-4:] == ".m4a":
|
||||||
print(f + " is a " + f[-3:] + " file, converting...")
|
print(f + " is a " + f[-3:] + " file, converting...")
|
||||||
OutFilePath = "./" + OutFolder + "/" + f[:-4] + ".ogg"
|
OutFilePath = "./" + OutFolder + "/" + f[:-4] + ".ogg"
|
||||||
# Transcode
|
# Transcode
|
||||||
system("ffmpeg -loglevel 0 -i \"" + InFilePath + "\" -c:a " + AudioAction + " \"" + OutFilePath + "\" && rm \"" + InFilePath + "\"")
|
system("ffmpeg -loglevel 0 -vn -i \"" + InFilePath + "\" -c:a " + AudioAction + " \"" + OutFilePath + "\" && rm \"" + InFilePath + "\"")
|
||||||
|
|
||||||
|
# If we run it through again, we convert the OGG to an MP3
|
||||||
|
if f[-4:] == ".ogg":
|
||||||
|
print(f + " is a " + f[-3:] + " file, converting...")
|
||||||
|
OutFilePath = "./" + OutFolder + "/" + f[:-4] + ".mp3"
|
||||||
|
# Transcode
|
||||||
|
system("ffmpeg -loglevel 0 -vn -i \"" + InFilePath + "\" -c:a " + "libmp3lame" + " \"" + OutFilePath + "\" && rm \"" + InFilePath + "\"")
|
||||||
|
|
||||||
|
if f[-5:] == ".webm":
|
||||||
|
print(f + " is a " + f[-4:] + " file, converting...")
|
||||||
|
OutFilePath = "./" + OutFolder + "/" + f[:-5] + ".ogg"
|
||||||
|
# Transcode
|
||||||
|
system("ffmpeg -loglevel 0 -vn -i \"" + InFilePath + "\" -c:a " + AudioAction + " \"" + OutFilePath + "\" && rm \"" + InFilePath + "\"")
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
if f[-5:] == ".webp":
|
if f[-5:] == ".webp":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user