Files
ffmpeg_collection/core_count_test 2.py
2023-03-26 18:31:49 +02:00

44 lines
1.2 KiB
Python

import subprocess
import sys
from pathlib import Path
import os
output_folder_name ="/bulk_convert_out/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
skipto = ""
duration = ""
print(droppedName)
#get path of script location and remove the tail
head_tail = os.path.split(sys.argv[0])
output_path = head_tail[0]
#skip first part of sys.argv since it points to script location
arguments = sys.argv[1:]
#check if output folder exists, otherwise create it
isExist = os.path.exists(output_path+output_folder_name)
if not isExist:
os.makedirs(output_path+output_folder_name)
i=1
x=5
while i < x:
for file in arguments:
basename = os.path.basename(file)
print(file)
args = 'ffmpeg.exe -i "{file}" -map 0:v -c:v libx265 -preset slow -crf 20 -x265-params "level=51:no-sao=1:bframes=8:psy-rd=1.5:psy-rdoq=5:aq-mode=3:ref=6" -pix_fmt yuv420p10le -map 0:a -c:a libopus -b:a 192k -map 0:s -c:s copy -f matroska "{output_path}{output_folder_name}{basename}"'.format(file=file, output_path=output_path, output_folder_name=output_folder_name, basename=basename)
print(args)
subprocess.run(args, returncode=0)
print(subprocess.CompletedProcess)
i=i+1
k=input("press close to exit")