added json tests

refactored main to utils add_input and add_output
used static ffmpeg paths
This commit is contained in:
2021-06-28 07:37:05 +02:00
parent 1563d333bb
commit 616a0416ba
2 changed files with 36 additions and 11 deletions

19
main.py
View File

@@ -1,7 +1,6 @@
import os
import shutil
# startdir = os.path.join("E:", "tmp", "input")
from Utils import FFEXE_STATIC, add_input, add_output
season = r"E:\tmp\Season2\\"
@@ -11,9 +10,7 @@ videodir = season + "video"
rescaleddir = season + "rescaled"
outputdir = season + "output"
networkdir = r"\\nas451\Video\serieUR\Kalkofes Mattscheibe - Premiere Klassiker\Season 2"
networkdir2 = r"\\nas451\Inbox\Kalkofe\Scale1080p\Season2\rescaled"
ffexe = r"C:\Users\Thaloria\Downloads\ffmpeg-4.4-full_build\bin\ffmpeg.exe"
# -i S01E01.mkv -map 0:a S01E01.m4a
# ffmpeg -i input.mp4 -map 0 -c copy -metadata:s:a:0 title="One" -metadata:s:a:1 title="Two" -metadata:s:a:0 language=eng -metadata:s:a:1 language=spa output.mp4
@@ -22,7 +19,9 @@ os.chdir(inputdir)
for file in os.listdir(inputdir):
ifilename = inputdir + "\\" + file
audiofilename = audiodir + "\\" + file[:6] + ".m4a"
cmd = ffexe + " -i " + ifilename + " -map 0:a -metadata:s:a:0 title='Original' -metadata:s:a:1 title='Audiokommentar' -metadata:s:a:0 language=ger -metadata:s:a:1 language=ger " + audiofilename
cmd = add_input(FFEXE_STATIC, ifilename)
cmd = cmd + " -map 0:a -metadata:s:a:0 title='Original' -metadata:s:a:1 title='Audiokommentar' -metadata:s:a:0 language=ger -metadata:s:a:1 language=ger"
cmd = add_output(cmd, audiofilename)
if not os.path.isfile(audiofilename):
os.system(cmd)
@@ -31,7 +30,9 @@ os.chdir(rescaleddir)
for file in os.listdir(rescaleddir):
ifilename = rescaleddir + "\\" + file
videofile = videodir + "\\" + file[:6] + ".mp4"
cmd = ffexe + " -i " + ifilename + " -map 0:v -c copy " + videofile
cmd = add_input(FFEXE_STATIC, ifilename)
cmd = cmd + " -map 0:v -c copy"
cmd = add_output(cmd, videofile)
if not os.path.isfile(videofile):
os.system(cmd)
@@ -41,7 +42,11 @@ for file in os.listdir(videodir):
videofile = videodir + "\\" + file
audiofilename = audiodir + "\\" + file[:6] + ".m4a"
outputfilename = outputdir + "\\" + file[:6] + ".mp4"
cmd = ffexe + " -i " + videofile + " -i " + audiofilename + " -map 0:v -map 1:a -metadata:s:a:0 title='Original' -metadata:s:a:1 title='Audiokommentar' -c copy " + outputfilename
cmd = add_input(FFEXE_STATIC, videofile)
cmd = add_input(cmd, audiofilename)
cmd = cmd + " -map 0:v -map 1:a -metadata:s:a:0 title='Original' -metadata:s:a:1 title='Audiokommentar' -c copy"
cmd = add_output(cmd, outputfilename)
if not os.path.isfile(outputfilename):
os.system(cmd)