This commit is contained in:
2026-02-26 15:52:01 +01:00
parent c326143eb8
commit f0faa57e98
51 changed files with 21457 additions and 22 deletions

View File

@@ -14,7 +14,7 @@ originalfiles = sys.orig_argv[2:]
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv)', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]

View File

@@ -14,7 +14,7 @@ originalfiles = sys.orig_argv[2:]
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv)', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]

143
bitrate_graph copy.py Normal file
View File

@@ -0,0 +1,143 @@
import subprocess
import sys
from pathlib import Path
import os
import re
import numpy as np
from matplotlib import pyplot as plt
from tqdm import tqdm
output_folder_name ="/bulk_convert_out/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
originalfiles = sys.orig_argv[2:]
size_list=[]
time_list=[]
seconds_list=[]
summed_list=[]
duration=[]
y=0
#originalfiles = ['E:\\Shadowplay\\Returnal\\ref.mkv']
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]
#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)
ffprobe_args = '.\\ffprobe.exe -v error -select_streams v:0 -i "{file}" -show_entries format=duration'.format(file=listed[0])
print(ffprobe_args)
ffprobe = subprocess.Popen(["powershell.exe", ffprobe_args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
for line in iter(ffprobe.stdout.readline,""):
if len(duration) < 1:
duration = re.findall('(?<=duration=).*',line)
duration = float(duration[0])
print(duration)
ffprobe_args = '.\\ffprobe.exe -v error -select_streams v:0 -i "{file}" -show_entries stream=duration:frame=pkt_size,pkt_pts_time'.format(file=listed[0])
print(ffprobe_args)
ffprobe = subprocess.Popen(["powershell.exe", ffprobe_args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
pbar= tqdm(desc='progress', total = duration)
for line in iter(ffprobe.stdout.readline,""):
time_in = re.findall('(?<=pkt_pts_time=).*',line)
size_in = re.findall('(?<=pkt_size=).*',line)
for each in time_in:
time_list.append(float(each))
i = time_list[-1]
y += 1
if y == 100:
pbar.n = i
pbar.refresh()
y=0
for each in size_in:
size_list.append(float(each)/1000)
#time_list = time_list + time_in
#size_list = size_list + size_in
num_time = len(time_list)
num_size = len(size_list)
#duration = time_list[num_time-1]
print("duration: ", duration)
print("time length: ", num_time)
print("size length:" , num_size)
def sum_seconds(list, x):
for each in list:
if each <= x:
pass
else:
highest_index = time_list.index(each)
return(int(highest_index))
a=0
b=len(time_list)
x=1
while x < duration+1:
outp = sum_seconds(time_list[a:b], x)
x+=1
seconds_list.append(outp)
#print(outp)
if x < duration+1:
summed_list.append(sum(size_list[a:outp]))
#print("summed list: ", summed_list)
a=outp
#print(summed_list)
length=len(summed_list)
newl=range(length)
print(length)
print(sum(summed_list))
print(sum(size_list))
fig, ax = plt.subplots()
ax.plot(newl, summed_list)
ax.set(xlabel='time', ylabel='KBps', label="test")
plt.fill_between(newl, summed_list)
plt.ticklabel_format(style='plain')
plt.title(listed[0])
plt.axhline(y=np.nanmean(summed_list), color='red', linestyle='--', label='Avg: '+str(round(np.nanmean(summed_list)))+'KBps')
plt.grid()
plt.margins(0)
plt.legend()
plt.show()
#k=input("press close to exit")

129
bitrate_graph.py Normal file
View File

@@ -0,0 +1,129 @@
import subprocess
import sys
from pathlib import Path
import os
import re
import numpy as np
from matplotlib import pyplot as plt
output_folder_name ="/bulk_convert_out/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
originalfiles = sys.orig_argv[2:]
size_list=[]
time_list=[]
seconds_list=[]
summed_list=[]
duration=""
#originalfiles = ['E:\\Shadowplay\\Returnal\\test.mov']
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]
#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)
ffprobe_args = '.\\ffprobe.exe -v error -select_streams v:0 -i "{file}" -show_entries stream=duration:frame=pkt_size,pkt_pts_time'.format(file=listed[0])
print(ffprobe_args)
ffprobe = subprocess.Popen(["powershell.exe", ffprobe_args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
for line in iter(ffprobe.stdout.readline,""):
time_in = re.findall('(?<=pkt_pts_time=).*',line)
size_in = re.findall('(?<=pkt_size=).*',line)
for each in time_in:
time_list.append(float(each))
for each in size_in:
size_list.append(float(each)/1000)
#time_list = time_list + time_in
#size_list = size_list + size_in
num_time = len(time_list)
num_size = len(size_list)
duration = time_list[num_time-1]
print("duration: ", duration)
print("time length: ", num_time)
print("size length:" , num_size)
def sum_seconds(list, x):
for each in list:
if each <= x:
pass
else:
highest_index = time_list.index(each)
return(int(highest_index))
a=0
b=len(time_list)
x=1
while x < duration+1:
outp = sum_seconds(time_list[a:b], x)
x+=1
seconds_list.append(outp)
#print(outp)
if x < duration+1:
summed_list.append(sum(size_list[a:outp]))
#print("summed list: ", summed_list)
a=outp
#print(summed_list)
length=len(summed_list)
newl=range(length)
print(length)
print(sum(summed_list))
print(sum(size_list))
#print(time_list)
#print("printing out", ffprobe_out)
#plt.plot(size_list, time_list)
#plt.show()
#print(type(time))
#print(time[1:2])
fig, ax = plt.subplots()
ax.plot(newl, summed_list)
ax.set(xlabel='time', ylabel='KBps', label="test")
plt.fill_between(newl, summed_list)
plt.ticklabel_format(style='plain')
plt.title(listed[0])
plt.axhline(y=np.nanmean(summed_list), color='red', linestyle='--', label='Avg: '+str(round(np.nanmean(summed_list)))+'KBps')
plt.grid()
plt.margins(0)
plt.legend()
plt.show()
#k=input("press close to exit")
#to question
# If I sum up all the frame bytes, and convert byte -> MebiByte (because windows says MegaByte but means Mebi, because MS), it is ~identical to file size in windows.
# So, why does my graph, that tracks nmcoder correctly, shows a much higher value? Nmcoder peaks at ~67725k, while mine peaks at

144
bitrate_graph_progress.py Normal file
View File

@@ -0,0 +1,144 @@
import subprocess
import sys
from pathlib import Path
import os
import re
import numpy as np
from matplotlib import pyplot as plt
from tqdm import tqdm
import math
output_folder_name ="/bulk_convert_out/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
originalfiles = sys.orig_argv[2:]
size_list=[]
time_list=[]
seconds_list=[]
summed_list=[]
duration=[]
#originalfiles = ['E:\Projects\VapourSYnth\VapourSynth64Portable\convert\\Lodoss-tou_Senki_-_Record_of_Lodoss_War_-_04_[BD.1080p]_[Iznjie_Biznjie]_[B4481C1E].mkv']
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]
#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)
ffprobe_args = '.\\ffprobe.exe -v error -select_streams v:0 -i "{file}" -show_entries format=duration'.format(file=listed[0])
print(ffprobe_args)
ffprobe = subprocess.Popen(["powershell.exe", ffprobe_args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
for line in iter(ffprobe.stdout.readline,""):
if len(duration) < 1:
duration = re.findall('(?<=duration=).*',line)
duration = float(duration[0])
print(duration)
ffprobe_args = '.\\ffprobe.exe -v error -select_streams v:0 -i "{file}" -show_entries frame=pkt_size,pkt_pts_time'.format(file=listed[0])
print(ffprobe_args)
ffprobe = subprocess.Popen(["powershell.exe", ffprobe_args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
pbar= tqdm(desc='progress', total = duration, bar_format="{l_bar}{bar:60}{r_bar}{bar:-10b}")
y=0
for line in iter(ffprobe.stdout.readline,""):
time_in = re.findall('(?<=pkt_pts_time=).*',line)
size_in = re.findall('(?<=pkt_size=).*',line)
for each in time_in:
time_list.append(float(each))
i = time_list[-1]
y += 1
if y == 100:
pbar.n = math.floor(i)
pbar.refresh()
y=0
for each in size_in:
size_list.append(float(each)/1024*8)
duration=time_list[-1]
num_time = len(time_list)
num_size = len(size_list)
print("duration: ", duration)
print("time length: ", num_time)
print("size length:" , num_size)
def sum_seconds(list, x):
for each in list:
if each < x:
pass
else:
highest_index = time_list.index(each)
return(int(highest_index))
a=0
b=len(time_list)
x=1
z=0
while x <= math.floor(duration):
outp = sum_seconds(time_list[a:b], x)
x+=1
seconds_list.append(outp)
#print(outp)
if x <= math.floor(duration):
summed_list.append(sum(size_list[a:outp]))
z+=1
#print("summed list: ", summed_list)
a=outp
#print(summed_list)
#print(size_list[-1:-10])
#print(time_list[-1:-10])
length=len(summed_list)
newl=range(length)
print(length)
print("size summed: " ,sum(summed_list))
print("size_ input: ",sum(size_list))
filename = Path(listed[0])
fig, ax = plt.subplots()
ax.plot(newl, summed_list)
ax.set(xlabel='time', ylabel='Kbits (Kilobits per sec)', label="test")
plt.fill_between(newl, summed_list)
plt.ticklabel_format(style='plain')
plt.title(filename.name)
plt.axhline(y=np.nanmean(summed_list), color='red', linestyle='--', label='Avg: '+str(round(np.nanmean(summed_list)))+'KBps')
plt.grid()
plt.margins(0)
plt.legend()
fig.set_size_inches(10,6)
plt.locator_params(axis='y', nbins=10)
plt.show()
#k=input("press close to exit")

View File

@@ -13,7 +13,7 @@ originalfiles = sys.orig_argv[2:]
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv)', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]

View File

@@ -0,0 +1,104 @@
import subprocess
import sys
from pathlib import Path
import os
from time import sleep
from threading import Thread
import threading
import re
max_threads=4
i=0
output_folder_name ="/bulk_convert_out/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
originalfiles = sys.orig_argv[2:]
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]
#droppedFile= ['test.mkv0out.mkv', "test.mkv1out.mkv","test.mkv2out.mkv","test.mkv3out.mkv","test.mkv4out.mkv","test.mkv5out.mkv"]
#get path of script location and remove the tail
head_tail = os.path.split(sys.argv[0])
#output_path = head_tail[0]
output_path = "F:/temp"
#skip first part of sys.argv since it points to script location
#arguments = sys.argv[1:]
#arguments = droppedFile
#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)
org_count = len(listed)
finished_count = int()
class CustomThread(Thread):
# constructor
def __init__(self):
# execute the base constructor
Thread.__init__(self)
# set a default value
def run(self):
#sleep(1)
global i
global finished_count
file=listed.pop(0)
basename = os.path.basename(file)
print(file)
#51: -c:a libopus -ac 6 -b:a 576k - standard -c:a libopus -b:a 192k
args = 'ffmpeg.exe -i "{file}" -map 0:t? -map 0:v:0 -c:v copy -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)
results = subprocess.Popen(args, creationflags=0x00004000, stdout=subprocess.PIPE)
#streeamdata = results.communicate()[0]
data = results.wait()
arg_list = 'mkvmerge.exe --output "E:/Projects/python/ffmpeg_work_folder/bulk_convert_out/mvkmergedupdated/{basename}" "{output_path}{output_folder_name}{basename}"'.format(file=file, output_path=output_path, output_folder_name=output_folder_name, basename=basename)
subprocess.run(arg_list)
print(output_path+output_folder_name+basename)
os.remove(output_path+output_folder_name+basename)
if data == 0:
i=i-1
finished_count=finished_count+1
while listed != False:
if i < max_threads:
global self
if bool(listed) != False:
t1 = CustomThread()
t1.start()
if bool(listed) == False:
while bool(threading.active_count() > 1):
print("Finished",finished_count,"out of", org_count," ")
sleep(1)
t1.join()
print("Completed",finished_count,"out of",org_count, "inputs Successfully")
input("waiting")
exit()
print("incrementing i in loop")
i=i+1
else:
print("Finished ",finished_count,"out of ", org_count)
sleep(1)
print("continuing ")

View File

@@ -15,6 +15,7 @@ i=0
output_folder_name ="/bulk_convert_out/"
#droppedFile= ['test.mkv0out.mkv', "test.mkv1out.mkv","test.mkv2out.mkv","test.mkv3out.mkv","test.mkv4out.mkv","test.mkv5out.mkv"]
#get path of script location and remove the tail
@@ -56,7 +57,7 @@ class CustomThread(Thread):
#sleep(1)
global i
global finished_count
file = str(input_file[0])
file = file.rstrip("\n")
basename=os.path.basename(file)

View File

@@ -0,0 +1,195 @@
import subprocess
import sys
from pathlib import Path
import os
from time import sleep
from threading import Thread
import threading
import re
import xml.etree.ElementTree as ET
file="test.txt"
max_threads=int(input("max threads: "))
print(type(max_threads))
i=0
output_folder_name ="/bulk_convert_out/"
target_bps_per_channel=96000
#audio_stringmap = ""
#droppedFile= ['test.mkv0out.mkv', "test.mkv1out.mkv","test.mkv2out.mkv","test.mkv3out.mkv","test.mkv4out.mkv","test.mkv5out.mkv"]
#get path of script location and remove the tail
#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:]
#arguments = droppedFile
#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)
def read_file(path=""):
with open(file,'r+') as f:
path = f.readlines(1)
all = f.readlines()
f.seek(0)
f.truncate()
f.writelines(all)
return path
class CustomThread(Thread):
# constructor
def __init__(self, input_file=""):
# execute the base constructor
Thread.__init__(self)
# set a default value
self.input_file = input_file
def run(self):
#sleep(1)
global i
audio_stringmap=""
stream_index_modify = []
channels_index_modify = []
stream_index = []
channels_index = []
file = str(input_file[0])
file = file.rstrip("\n")
os.rename(file, file+"i")
mkvmerge_input = file+"i"
mkv_args = 'mkvmerge.exe --output "{file}" "{mkvmerge_input}"'.format(file=file, output_path=output_path, output_folder_name=output_folder_name, mkvmerge_input=mkvmerge_input)
mkv_run = subprocess.run(mkv_args)
#wait = mkv_run.wait()
print("before remove file")
os.remove(file+"i")
basename = os.path.basename(file)
print(file)
sleep(1)
#find audio channels to encode
ffprobe_args = '.\\ffprobe.exe -i "{file}" -show_entries format:streams -of xml'.format(file=file)
print(ffprobe_args)
ffprobe = subprocess.Popen(["powershell.exe", ffprobe_args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
ffprobe_out = ffprobe.communicate()[0]
print("printing out", ffprobe_out)
root = ET.fromstring(ffprobe_out)
streams = root[1].findall("stream")
m_index=0
for index in streams:
if index.get("codec_type") == "audio":
stream_channels = int(index.get("channels"))
for tag in index.findall("tag"):
if tag.get("key") == "BPS":
BPS_Value = int(tag.get("value"))
print("printing index: ", index.get("index"))
print("printing BPS: ", BPS_Value)
#to fix: specifying a codec specifies it for _output stream_ not input:https://superuser.com/questions/1669264/how-is-this-ffmpeg-map-documentation-okay
if BPS_Value >= target_bps_per_channel*stream_channels*1.2:
#stream_index_modify.append(int(index.get("index"))-1)
#channels_index_modify.append(int(index.get("channels")))
#m_index = int(index.get("index"))
#m_index -= 1
c_index = int(index.get("channels"))
print(m_index)
bitrate = int(stream_channels*target_bps_per_channel/1000)
test_map = "-map 0:a:{m_index} -c:a:{m_index} libopus -ac:a:{m_index} {c_index} -b:a:{m_index} {bitrate}k ".format(m_index=m_index,c_index=c_index, bitrate=bitrate,stream_channels=stream_channels)
audio_stringmap += test_map
m_index+=1
else:
#stream_index.append(int(index.get("index"))-1)
#channels_index.append(int(index.get("channels")))
m_index = int(index.get("index"))
m_index -= 1
c_index = int(index.get("channels"))
bitrate = int(stream_channels*target_bps_per_channel/1000)
test_map = "-map 0:a:{m_index} -c:a:{m_index} copy ".format(m_index=m_index,c_index=c_index, bitrate=bitrate,stream_channels=stream_channels)
audio_stringmap += test_map
m_index+=1
x=0
print("streams to transcode: ", stream_index_modify)
print("channels to modify", channels_index_modify)
print("streams to copy: ", stream_index)
print("channels to copy: ", channels_index)
#for each in stream_index_modify:
# #to fix: specifying a codec specifies it for _output stream_ not input.
# channel_layout = channels_index_modify[x]
# bitrate = int(channel_layout*target_bps_per_channel/1000)
# audio_stringmap += "-map 0:a:{each} -c:a:{each} libopus -ac:a:{each} {channel_layout} -b:a:{each} {bitrate}k ".format(each=each,bitrate=bitrate,channel_layout=channel_layout)
# x+=1
# #print(audio_stringmap)
#x=0
#for each in stream_index:
#
# channel_layout = channels_index[x]
# bitrate = int(channel_layout*target_bps_per_channel/1000)
# audio_stringmap += "-map 0:a:{each} -c:a:{each} copy ".format(each=each,bitrate=bitrate,channel_layout=channel_layout)
# x+=1
#print(audio_stringmap)
args = 'ffmpeg.exe -analyzeduration 20000000 -probesize 200M -i "{file}" -fps_mode passthrough -map 0:t? -map 0:v:0? -c:v libx265 -preset slow -crf 15.4 -x265-params "no-sao=1:bframes=8:psy-rd=2:psy-rdoq=1.5:aq-mode=3:ref=6:deblock=-1,-1" -pix_fmt yuv420p10le {audio_stringmap} -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, audio_stringmap=audio_stringmap)
print(args)
results = subprocess.Popen(args, creationflags=0x00004000, stdout=subprocess.PIPE)
#streeamdata = results.communicate()[0]
data = results.wait()
arg_list = 'mkvmerge.exe --output "{output_path}{output_folder_name}/mvkmergedupdated/{basename}" "{output_path}{output_folder_name}{basename}"'.format(file=file, output_path=output_path, output_folder_name=output_folder_name, basename=basename)
print(arg_list)
merg_results = subprocess.Popen(arg_list)
if data == 0:
i=i-1
filesize = os.path.getsize(file)
while filesize != 0:
if i < max_threads:
global self
filesize = os.path.getsize(file)
if filesize != 0:
input_file = read_file()
print(input_file)
t1 = CustomThread(input_file)
t1.start()
if filesize == 0:
while bool(threading.active_count() > 1):
print("Finished","out of", )
sleep(1)
filesize = os.path.getsize(file)
if filesize != 0:
print("breaking while")
break
filesize = os.path.getsize(file)
if filesize != 0:
print("breaking if")
continue
t1.join()
print("Completed","out of", "inputs Successfully")
input("waiting")
exit()
print("incrementing i in loop")
i=i+1
else:
print("Finished ","out of ")
sleep(1)
print("continuing ")

View File

@@ -0,0 +1,201 @@
import subprocess
import sys
from pathlib import Path
import os
from time import sleep
from threading import Thread
import threading
import re
import xml.etree.ElementTree as ET
file="test.txt"
max_threads=int(input("max threads: "))
print(type(max_threads))
i=0
output_folder_name ="/bulk_convert_out/"
temp_folder = "F:/temp/"
ffmpeg_temp = "F:/temp/encoded/"
target_bps_per_channel=96000
#audio_stringmap = ""
#droppedFile= ['test.mkv0out.mkv', "test.mkv1out.mkv","test.mkv2out.mkv","test.mkv3out.mkv","test.mkv4out.mkv","test.mkv5out.mkv"]
#get path of script location and remove the tail
#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:]
#arguments = droppedFile
#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)
def read_file(path=""):
with open(file,'r+') as f:
path = f.readlines(1)
all = f.readlines()
f.seek(0)
f.truncate()
f.writelines(all)
return path
class CustomThread(Thread):
# constructor
def __init__(self, input_file=""):
# execute the base constructor
Thread.__init__(self)
# set a default value
self.input_file = input_file
def run(self):
#sleep(1)
global i
audio_stringmap=""
stream_index_modify = []
channels_index_modify = []
stream_index = []
channels_index = []
file = str(input_file[0])
file = file.rstrip("\n")
#os.rename(file, file+"i")
basename = os.path.basename(file)
mkvmerge_output = temp_folder+basename
mkv_args = 'mkvmerge.exe --output "{mkvmerge_output}" "{file}"'.format(file=file,mkvmerge_output=mkvmerge_output, output_path=output_path, output_folder_name=output_folder_name)
mkv_run = subprocess.Popen(mkv_args)
mkv_run.wait()
print("before remove file")
#os.remove(file+"i")
file = mkvmerge_output
basename = os.path.basename(file)
print(file)
sleep(1)
#find audio channels to encode
ffprobe_args = '.\\ffprobe.exe -i "{file}" -show_entries format:streams -of xml'.format(file=file)
print(ffprobe_args)
ffprobe = subprocess.Popen(["powershell.exe", ffprobe_args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
ffprobe_out = ffprobe.communicate()[0]
print("printing out", ffprobe_out)
root = ET.fromstring(ffprobe_out)
streams = root[1].findall("stream")
m_index=0
for index in streams:
if index.get("codec_type") == "audio":
stream_channels = int(index.get("channels"))
for tag in index.findall("tag"):
if tag.get("key") == "BPS":
BPS_Value = int(tag.get("value"))
print("printing index: ", index.get("index"))
print("printing BPS: ", BPS_Value)
#to fix: specifying a codec specifies it for _output stream_ not input:https://superuser.com/questions/1669264/how-is-this-ffmpeg-map-documentation-okay
if BPS_Value >= target_bps_per_channel*stream_channels*1.2:
#stream_index_modify.append(int(index.get("index"))-1)
#channels_index_modify.append(int(index.get("channels")))
#m_index = int(index.get("index"))
#m_index -= 1
c_index = int(index.get("channels"))
print(m_index)
bitrate = int(stream_channels*target_bps_per_channel/1000)
test_map = "-map 0:a:{m_index} -c:a:{m_index} libopus -ac:a:{m_index} {c_index} -b:a:{m_index} {bitrate}k ".format(m_index=m_index,c_index=c_index, bitrate=bitrate,stream_channels=stream_channels)
audio_stringmap += test_map
m_index+=1
else:
#stream_index.append(int(index.get("index"))-1)
#channels_index.append(int(index.get("channels")))
m_index = int(index.get("index"))
m_index -= 1
c_index = int(index.get("channels"))
bitrate = int(stream_channels*target_bps_per_channel/1000)
test_map = "-map 0:a:{m_index} -c:a:{m_index} copy ".format(m_index=m_index,c_index=c_index, bitrate=bitrate,stream_channels=stream_channels)
audio_stringmap += test_map
m_index+=1
x=0
print("streams to transcode: ", stream_index_modify)
print("channels to modify", channels_index_modify)
print("streams to copy: ", stream_index)
print("channels to copy: ", channels_index)
#for each in stream_index_modify:
# #to fix: specifying a codec specifies it for _output stream_ not input.
# channel_layout = channels_index_modify[x]
# bitrate = int(channel_layout*target_bps_per_channel/1000)
# audio_stringmap += "-map 0:a:{each} -c:a:{each} libopus -ac:a:{each} {channel_layout} -b:a:{each} {bitrate}k ".format(each=each,bitrate=bitrate,channel_layout=channel_layout)
# x+=1
# #print(audio_stringmap)
#x=0
#for each in stream_index:
#
# channel_layout = channels_index[x]
# bitrate = int(channel_layout*target_bps_per_channel/1000)
# audio_stringmap += "-map 0:a:{each} -c:a:{each} copy ".format(each=each,bitrate=bitrate,channel_layout=channel_layout)
# x+=1
#print(audio_stringmap)
args = 'ffmpeg.exe -analyzeduration 20000000 -probesize 200M -i "{file}" -fps_mode passthrough -map 0:t? -map 0:v:0? -c:v libx265 -preset slow -crf 15.4 -x265-params "no-sao=1:bframes=8:psy-rd=2:psy-rdoq=1.5:aq-mode=3:ref=6:deblock=-1,-1" -pix_fmt yuv420p10le {audio_stringmap} -map 0:s? -c:s copy -f matroska "{ffmpeg_temp}{basename}"'.format(file=file, basename=basename, audio_stringmap=audio_stringmap, ffmpeg_temp=ffmpeg_temp)
print(args)
results = subprocess.Popen(args, creationflags=0x00004000, stdout=subprocess.PIPE)
#streeamdata = results.communicate()[0]
data = results.wait()
arg_list = 'mkvmerge.exe --output "{output_path}{output_folder_name}/mvkmergedupdated/{basename}" "{ffmpeg_temp}{basename}"'.format(file=file, output_path=output_path, output_folder_name=output_folder_name, basename=basename, ffmpeg_temp=ffmpeg_temp)
print(arg_list)
merg_results = subprocess.Popen(arg_list)
merg_results.wait()
os.remove(mkvmerge_output)
os.remove(ffmpeg_temp+basename)
if data == 0:
i=i-1
filesize = os.path.getsize(file)
while filesize != 0:
if i < max_threads:
global self
filesize = os.path.getsize(file)
if filesize != 0:
input_file = read_file()
print(input_file)
t1 = CustomThread(input_file)
t1.start()
if filesize == 0:
while bool(threading.active_count() > 1):
print("Finished","out of", )
sleep(1)
filesize = os.path.getsize(file)
if filesize != 0:
print("breaking while")
break
filesize = os.path.getsize(file)
if filesize != 0:
print("breaking if")
continue
t1.join()
print("Completed","out of", "inputs Successfully")
input("waiting")
exit()
print("incrementing i in loop")
i=i+1
else:
print("Finished ","out of ")
sleep(1)
print("continuing ")

View File

@@ -0,0 +1,137 @@
import subprocess
import sys
from pathlib import Path
import os
from time import sleep
from threading import Thread
import threading
import re
import xml.etree.ElementTree as ET
file="metadata_refresh.txt"
max_threads=int(input("max threads: "))
print(type(max_threads))
i=0
output_folder_name ="/bulk_convert_out/mvkmergedupdated/"
target_bps_per_channel=96000
#audio_stringmap = ""
#droppedFile= ['E:\Shadowplay\Returnal"]
#get path of script location and remove the tail
#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:]
#arguments = droppedFile
#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)
def read_file(path=""):
with open(file,'r+') as f:
path = f.readlines(1)
all = f.readlines()
f.seek(0)
f.truncate()
f.writelines(all)
return path
class CustomThread(Thread):
# constructor
def __init__(self, input_file=""):
# execute the base constructor
Thread.__init__(self)
# set a default value
self.input_file = input_file
def run(self):
#sleep(1)
global i
file = str(input_file[0])
file = file.rstrip("\n")
pathlibname = Path(file)
show_folder_name = pathlibname.parent.parent.name
season_folder_name = "/" + pathlibname.parent.name
isExist = os.path.exists(output_path+output_folder_name+show_folder_name)
if not isExist:
os.makedirs(output_path+output_folder_name+show_folder_name)
sleep(1)
isExist = os.path.exists(output_path+output_folder_name+show_folder_name+season_folder_name)
if not isExist:
os.makedirs(output_path+output_folder_name+show_folder_name+season_folder_name)
sleep(1)
sleep(1)
#os.rename(file, file+"i")
mkvmerge_input = file
basename = os.path.basename(file)
mkv_args = 'mkvmerge.exe --output "{output_path}{output_folder_name}/{show_folder_name}/{season_folder_name}/{basename}" "{mkvmerge_input}"'.format(basename=basename, file=file, output_path=output_path,season_folder_name=season_folder_name,show_folder_name=show_folder_name, output_folder_name=output_folder_name, mkvmerge_input=mkvmerge_input)
mkv_run = subprocess.Popen(mkv_args)
#wait = mkv_run.wait()
data = mkv_run.wait()
print("before remove file")
#os.remove(file+"i")
basename = os.path.basename(file)
print(file)
sleep(1)
if data == 0:
i=i-1
filesize = os.path.getsize(file)
while filesize != 0:
if i < max_threads:
global self
filesize = os.path.getsize(file)
if filesize != 0:
input_file = read_file()
print(input_file)
t1 = CustomThread(input_file)
t1.start()
if filesize == 0:
while bool(threading.active_count() > 1):
print("Finished","out of", )
sleep(1)
filesize = os.path.getsize(file)
if filesize != 0:
print("breaking while")
break
filesize = os.path.getsize(file)
if filesize != 0:
print("breaking if")
continue
t1.join()
print("Completed","out of", "inputs Successfully")
input("waiting")
exit()
print("incrementing i in loop")
i=i+1
else:
print("Finished ","out of ")
sleep(1)
print("continuing ")

View File

@@ -0,0 +1,73 @@
import subprocess
import sys
from pathlib import Path
import os
from time import sleep
from threading import Thread
import threading
import re
file="input.txt"
max_threads=int(input("max threads: "))
print(type(max_threads))
i=0
output_folder_name ="/bulk_convert_out/"
#droppedFile= ['test.mkv0out.mkv', "test.mkv1out.mkv","test.mkv2out.mkv","test.mkv3out.mkv","test.mkv4out.mkv","test.mkv5out.mkv"]
#get path of script location and remove the tail
#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:]
#arguments = droppedFile
#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)
def read_file(path=""):
with open(file,'r+') as f:
path = f.readlines(1)
all = f.readlines()
f.seek(0)
f.truncate()
f.writelines(all)
return path
#sleep(1)
filesize = os.path.getsize(file)
if filesize != 0:
input_file = read_file()
input_string = str(input_file[0])
print(input_string)
input_string = input_string.rstrip("\n")
print(input_string)
split_input = input_string.split(";", 1)
print(split_input)
basename=os.path.basename(input_string[0])
print(input_string)
infile = split_input[0]
vapfile = split_input[1]
args = 'E:/Projects/VapourSYnth/VapourSynth64Portable/VapourSynth64/vspipe.exe --arg source={infile} {vapfile} -c y4m -'.format(infile=infile, vapfile=vapfile, output_path=output_path, output_folder_name=output_folder_name, basename=basename)
print(args)
conv = subprocess.Popen(args, creationflags=0x00004000, stdout=subprocess.PIPE)
output = subprocess.check_output(('ffmpeg.exe -i pipe:0 -map 0:v -c:v libx265 -preset slow -crf 15.4 -x265-params "no-sao=1:bframes=8:psy-rd=2:psy-rdoq=1.5:aq-mode=3:ref=6:deblock=-1,-1" -pix_fmt yuv420p10le -f matroska "{output_path}{output_folder_name}test_list_{basename}"'.format(file=file, output_path=output_path, output_folder_name=output_folder_name, basename=basename)), stdin=conv.stdout)
#streeamdata = results.communicate()[0]
# data = output.wait()

159
bulk_threading_test_test.py Normal file
View File

@@ -0,0 +1,159 @@
import subprocess
import sys
from pathlib import Path
import os
from time import sleep
from threading import Thread
import threading
import re
import xml.etree.ElementTree as ET
max_threads=4
i=0
output_folder_name ="/bulk_convert_out/"
stream_index_modify = []
channels_index_modify = []
stream_index = []
channels_index = []
target_bps_per_channel=96000
audio_stringmap = ""
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
originalfiles = sys.orig_argv[2:]
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]
#droppedFile= ['test.mkv0out.mkv', "test.mkv1out.mkv","test.mkv2out.mkv","test.mkv3out.mkv","test.mkv4out.mkv","test.mkv5out.mkv"]
#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:]
#arguments = droppedFile
#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)
org_count = len(listed)
finished_count = int()
class CustomThread(Thread):
# constructor
def __init__(self):
# execute the base constructor
Thread.__init__(self)
# set a default value
def run(self):
#sleep(1)
global i
global finished_count
global audio_stringmap
file=listed.pop(0)
os.rename(file, file+"i")
mkvmerge_input = file+"i"
mkv_args = 'mkvmerge.exe --output "{file}" "{mkvmerge_input}"'.format(file=file, output_path=output_path, output_folder_name=output_folder_name, mkvmerge_input=mkvmerge_input)
mkv_run = subprocess.run(mkv_args)
#wait = mkv_run.wait()
print("before remove file")
os.remove(file+"i")
basename = os.path.basename(file)
print(file)
sleep(1)
#find audio channels to encode
ffprobe_args = '.\\ffprobe.exe -i "{file}" -show_entries format:streams -of xml'.format(file=file)
print(ffprobe_args)
ffprobe = subprocess.Popen(["powershell.exe", ffprobe_args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
ffprobe_out = ffprobe.communicate()[0]
print("printing out", ffprobe_out)
root = ET.fromstring(ffprobe_out)
streams = root[1].findall("stream")
for index in streams:
if index.get("codec_type") == "audio":
stream_channels = int(index.get("channels"))
for tag in index.findall("tag"):
if tag.get("key") == "BPS":
BPS_Value = int(tag.get("value"))
if BPS_Value >= target_bps_per_channel*stream_channels*1.2:
stream_index_modify.append(int(index.get("index"))-1)
channels_index_modify.append(int(index.get("channels")))
else:
stream_index.append(int(index.get("index"))-1)
channels_index.append(int(index.get("channels")))
x=0
print("streams to transcode: ", stream_index_modify)
print("channels to modify", channels_index_modify)
print("streams to copy: ", stream_index)
print("channels to copy: ", channels_index)
for each in stream_index_modify:
channel_layout = channels_index_modify[x]
bitrate = int(channel_layout*target_bps_per_channel/1000)
audio_stringmap += "-map 0:a:{each} -c:a:{each} libopus -ac:a:{each} {channel_layout} -b:a:{each} {bitrate}k ".format(each=each,bitrate=bitrate,channel_layout=channel_layout)
x+=1
#print(audio_stringmap)
x=0
for each in stream_index:
channel_layout = channels_index[x]
bitrate = int(channel_layout*target_bps_per_channel/1000)
audio_stringmap += "-map 0:a:{each} -c:a:{each} copy ".format(each=each,bitrate=bitrate,channel_layout=channel_layout)
x+=1
print(audio_stringmap)
args = 'ffmpeg.exe -analyzeduration 20000000 -probesize 20000000 -i "{file}" -fps_mode passthrough -map 0:t? -map 0:v:0? -c:v libx265 -preset slow -crf 15.4 -x265-params "no-sao=1:bframes=8:psy-rd=2:psy-rdoq=1.5:aq-mode=3:ref=6:deblock=-1,-1" -pix_fmt yuv420p10le {audio_stringmap} -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, audio_stringmap=audio_stringmap)
print(args)
results = subprocess.Popen(args, creationflags=0x00004000, stdout=subprocess.PIPE)
#streeamdata = results.communicate()[0]
data = results.wait()
if data == 0:
i=i-1
finished_count=finished_count+1
while listed != False:
if i < max_threads:
global self
if bool(listed) != False:
t1 = CustomThread()
t1.start()
if bool(listed) == False:
while bool(threading.active_count() > 1):
print("Finished",finished_count,"out of", org_count," ")
sleep(1)
t1.join()
print("Completed",finished_count,"out of",org_count, "inputs Successfully")
input("waiting")
exit()
print("incrementing i in loop")
i=i+1
else:
print("Finished ",finished_count,"out of ", org_count)
sleep(1)
print("continuing ")

View File

@@ -5,6 +5,7 @@ from pathlib import Path
import os
import xml.etree.ElementTree as ET
output_folder_name = "/out_sub_audio/"
regex_subtitle = re.compile("Stream #0:\d+(\(\w*\))?: Subtitle:.*")
regex_audio = re.compile("Stream #0:\d(\(\w*\))?: Audio:.*")
@@ -15,13 +16,22 @@ files_processed = []
#originalfiles = sys.orig_argv[2:]
audio_list = []
sub_list = []
stream_index_modify = []
channels_index_modify = []
stream_index = []
channels_index = []
target_bps_per_channel=96000
audio_stringmap = ""
test_string=""
m_index=int()
# To fix I need to create symlinks to files with long paths and use the links instead. And then remove said symlinks once
#droppedFile= ['X:\\test\\longpathtest\\longerpathlongerpathlongerpathlongerpathlongerpathlongerpathlongerpath\\longpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpath\\fourteen\\[Kira-Fansub]_Choujuushin Gravion_Episode 06_(BD 1280x960 h264 JP AAC EN AAC) [E7D92968].mkv', '', ' X:\\test\\longpathtest\\longerpathlongerpathlongerpathlongerpathlongerpathlongerpathlongerpath\\longpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpathlongpath\\fourteen\\[Kira-Fansub]_Choujuushin Gravion_Episode 09_(BD 1280x960 h264 JP AAC EN AAC) [A2727604].mkv']
originalfiles = ['E:\\Projects\\python\\ffmpeg_work_folder\\01 - The Great Tower of Druaga (Inner).mkv']
#originalfiles = ['E:\\torrents\\anime_works\\Tower of God S01 (BD 1080p HEVC) [Dual-Audio] [Vodes]\\[Vodes] Tower of God - S01E01 (BD 1080p).mkv']
originalfiles = ['E:\\out\\ORIGINAL_COMP_0Muv-Luv Alternative Total Eclipse S01E01 2012 Bluray 1080p DTS-HD MA 2.0 AVC REMUX Dual Audio-ZR-.mkv']
@@ -56,29 +66,94 @@ for i, file in enumerate(listed):
print("file", i+1,":", Path(file).name)
print(subprocess_err)
#print(subprocess_err)
root = ET.fromstring(subprocess_err)
#print(root)
streams = root[1].findall("stream")
print(streams)
#print(streams)
for stream in streams:
if stream.get("codec_type") == "audio":
index = stream.get("index")
print("index:", stream.get("index"))
print("channels:",stream.get("channels"))
print("printing index variable:" ,index )
# for stream in streams:
# if stream.get("codec_type") == "audio":
# index = stream.get("index")
# print("index:", stream.get("index"))
# print("channels:",stream.get("channels"))
# print("printing index variable:" ,index )
#
# for tag in stream.findall("tag"):
# if tag.get("key") == "title":
# print("name:", tag.get("value"))
# if tag.get("key") == "BPS":
# print("BPS:",tag.get("value"))
for tag in stream.findall("tag"):
if tag.get("key") == "title":
print("name:", tag.get("value"))
for index in streams:
if index.get("codec_type") == "audio":
stream_channels = int(index.get("channels"))
for tag in index.findall("tag"):
if tag.get("key") == "BPS":
print("BPS:",tag.get("value"))
BPS_Value = int(tag.get("value"))
if BPS_Value >= target_bps_per_channel*stream_channels*1.2:
#stream_index_modify.append(int(index.get("index"))-1)
#channels_index_modify.append(int(index.get("channels")))
m_index = int(index.get("index"))
m_index -= 1
c_index = int(index.get("channels"))
print(m_index)
bitrate = int(stream_channels*target_bps_per_channel/1000)
test_map = "-map 0:a:{m_index} -c:a:{m_index} libopus -ac:a:{c_index} {stream_channels} -b:a:{m_index} {bitrate}k ".format(m_index=m_index,c_index=c_index, bitrate=bitrate,stream_channels=stream_channels)
test_string += test_map
else:
#stream_index.append(int(index.get("index"))-1)
#channels_index.append(int(index.get("channels")))
m_index = int(index.get("index"))
m_index -= 1
c_index = int(index.get("channels"))
bitrate = int(stream_channels*target_bps_per_channel/1000)
test_map = "-map 0:a:{m_index} -c:a:{m_index} libopus -ac:a:{c_index} {stream_channels} -b:a:{m_index} {bitrate}k ".format(m_index=m_index,c_index=c_index, bitrate=bitrate,stream_channels=stream_channels)
audio_stringmap += test_map
print("streams to transcode: ", stream_index_modify)
print("channels to modify", channels_index_modify)
print("streams to copy: ", stream_index)
print("channels to copy: ", channels_index)
print("test map: ", test_string)
#create ffmpeg string
x=0
for each in stream_index_modify:
channel_layout = channels_index_modify[x]
bitrate = int(channel_layout*target_bps_per_channel/1000)
audio_stringmap += "-map 0:a:{each} -c:a libopus -ac {channel_layout} -b:a {bitrate}k ".format(each=each,bitrate=bitrate,channel_layout=channel_layout)
x+=1
#print(audio_stringmap)
x=0
for each in stream_index:
channel_layout = channels_index[x]
bitrate = int(channel_layout*target_bps_per_channel/1000)
audio_stringmap += "-map 0:a:{each} -c:a copy ".format(each=each,bitrate=bitrate,channel_layout=channel_layout)
x+=1
print(audio_stringmap)
#def gen_audio_string(index, channels):
# x=0
# stringmap=""
# for each in index:
# channel_layout = channels[x]
# bitrate = int(channel_layout*target_bps_per_channel/1000)
# stringmap += "-map 0:a:{each} -c:a libopus -ac {channel_layout} -b:a {bitrate}k ".format(each=each,bitrate=bitrate,channel_layout=channel_layout)
# x+=1
# return(stringmap)
#print(gen_audio_string(stream_index_modify, channels_index_modify))
#print(gen_audio_string(stream_index, channels_index))
#audio_stringmap=(gen_audio_string(stream_index_modify, channels_index_modify))+(gen_audio_string(stream_index, channels_index))
print(audio_stringmap)

0
metadata_refresh.txt Normal file
View File

62
metrics_run.py Normal file
View File

@@ -0,0 +1,62 @@
import subprocess
import sys
from pathlib import Path
import os
import re
output_folder_name ="/bulk_convert_out/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
originalfiles = sys.orig_argv[2:]
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]
#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)
print("input 0: ", listed[0])
print("input 1: ", listed[1])
x=int(input("select reference file: "))
ref= listed.pop(x)
print(listed)
print("selected reference file is: ", ref)
print("1: vmaf_v0.6.1.json")
print("2: vmaf_4k_v0.6.1.json")
x=int(input("select vmaf model: "))
if x == 1:
scale = '"scale=1920:1080"'
model = "vmaf_v0.6.1"
else:
scale = '"scale=3840:2160"'
model = "vmaf_4k_v0.6.1"
#basename = os.path.basename(file)
args = 'ffmpeg.exe -i "{distorted}" -i "{reference}" -lavfi "[0:v]{scale}[distorted];[1:v]{scale}[reference]; [distorted][reference]libvmaf='"'"'model=version=vmaf_v0.6.1:feature=name=psnr|name=float_ssim:n_threads=12:log_path=log.txt:log_fmt=json'"'"'" -f null -'.format(distorted=listed[0],reference=ref,scale=scale, model=model)
print(args)
subprocess.run(args)
k=input("press close to exit")

68
metrics_run_copy.py Normal file
View File

@@ -0,0 +1,68 @@
import subprocess
import sys
from pathlib import Path
import os
import re
from ffmpeg_quality_metrics import FfmpegQualityMetrics
output_folder_name ="/bulk_convert_out/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
originalfiles = sys.orig_argv[2:]
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]
#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)
print("input 0: ", listed[0])
print("input 1: ", listed[1])
x=int(input("select reference file: "))
ref= listed.pop(x)
print(listed)
print("selected reference file is: ", ref)
print("1: vmaf_v0.6.1.json")
print("2: vmaf_4k_v0.6.1.json")
x=int(input("select vmaf model: "))
if x == 1:
scale = '"scale=1920:1080"'
model = "vmaf_v0.6.1"
else:
scale = '"scale=3840:2160"'
model = "vmaf_4k_v0.6.1"
#basename = os.path.basename(file)
#
args = 'ffmpeg-quality-metrics "{distorted}" "{reference}" -p -m psnr ssim vmaf -t 12 --vmaf-threads 12 '.format(distorted=listed[0],reference=ref,scale=scale, model=model)
#print(args)
subprocess.run(args)
#ffqm =FfmpegQualityMetrics(ref, listed[0])
#metrics = ffqm.calculate(["ssim", "psnr"])
#print(metrics.keys)
#print(sum([frame["ssim_y"] for frame in metrics["ssim"]]) / len(metrics["ssim"]))
#print(ffqm.get_global_stats()["ssim"]["ssim_y"]["average"])
k=input("press close to exit")

View File

@@ -23,7 +23,7 @@ originalfiles = sys.orig_argv[2:]
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv)', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]

6100
out.txt Normal file

File diff suppressed because it is too large Load Diff

21
path_test.py Normal file
View File

@@ -0,0 +1,21 @@
path = "X:\Media\Anime\Stratos 4 (2003) [tvdb-79022]\Season 01\Stratos 4 (2003) - S01E03 - 003 - Code 103 Decision Height [SDTV][8bit][XviD][Vorbis 2.0][JA]-ZFB.mkv"
import os
from pathlib import Path
file = Path(path)
print(os.path.dirname(file))
print(os.path.dirname(os.path.dirname(file)))
print(file.parent.parent.name)
print()
show_folder_name = file.parent.parent.name
season_folder_name = file.parent.name
print(show_folder_name)
print(season_folder_name)

View File

@@ -24,7 +24,7 @@ if not isExist:
#lines = "-map 0:v -c:v libx265 -preset slow -crf 22 -x265-params level=51:no-sao=1:bframes=8:psy-rd=1.5:psy-rdoq=1.5:aq-mode=3:ref=6 -pix_fmt yuv420p10le -map 0:a -c:a copy -map 0:s -c:s copy"
org_lineslines = " -map 0:v -c:v copy -map 0:a? -c:a copy -map 0:s? -c:s copy"
org_lineslines = " -map 0:v:0? -c:v copy -map 0:a? -c:a copy -map 0:s? -c:s copy"
number_of_segments=int(input("Number of segments: "))

View File

@@ -0,0 +1,87 @@
import re
import subprocess
import sys
from pathlib import Path
import os
import time as clock
output_folder_name = "/quality_test_originals/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
#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)
#droppedFile = ["sam_overlord_bluraysource.mkv"]
#lines = "-map 0:v -c:v libx265 -preset slow -crf 22 -x265-params level=51:no-sao=1:bframes=8:psy-rd=1.5:psy-rdoq=1.5:aq-mode=3:ref=6 -pix_fmt yuv420p10le -map 0:a -c:a copy -map 0:s -c:s copy"
org_lineslines = " -map 0:v:0? -c:v copy -map 0:a? -c:a copy -map 0:s? -c:s copy"
number_of_segments=int(input("Number of segments: "))
segment_length=int(input("How long should each segment be(seconds)? "))
for i, file in enumerate(arguments):
arg_list = 'ffprobe.exe -show_entries format=duration -i "{file}"'.format(file=file)
print(arg_list)
cmd = subprocess.Popen(arg_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
subprocess_std = cmd.communicate()[0]
print("stdout printing: " , subprocess_std)
video_duration = [int(s) for s in re.findall(r"[0-9]+", subprocess_std)][0]
print("video_duration: ", video_duration, "s")
duration_percent = video_duration / 100
print(duration_percent)
time = duration_percent * 15
skip = ((duration_percent * 90) - (duration_percent* 20)) / (number_of_segments -1)
for i in range(0, number_of_segments):
basename = os.path.basename(file)
#args = 'ffmpeg.exe -i "{file}" -ss {time} -t {segment_length} {lines} -f matroska "{file}{i}out.mkv"'.format(time=skip*i+time, segment_length=segment_length, file=file, lines=lines, i=i)
args = 'ffmpeg.exe -ss {time} -i "{file}" -t {segment_length} {org_lineslines} -f matroska "{output_path}{output_folder_name}ORIGINAL_COMP_{i}{basename}"'.format(time=skip*i+time, segment_length=segment_length, file=file, org_lineslines=org_lineslines, output_path=output_path, output_folder_name=output_folder_name, basename=basename, i=i)
print(args)
run = subprocess.Popen(args, creationflags=0x00004000)
results = run.wait()
f = open(file+".txt","a")
string = "file '{output_path}{output_folder_name}ORIGINAL_COMP_{i}{basename}'".format(output_path=output_path, output_folder_name=output_folder_name, i=i, basename=basename)
f.write(string+"\n")
f.close
print('\n')
clock.sleep(2)
#file = arguments[0]
for each in arguments:
file = each
basename = os.path.basename(each)
combi_args = 'ffmpeg.exe -f concat -safe 0 -i "{file}.txt" -codec copy "{output_path}{output_folder_name}ORIGINAL_MERGE_{basename}"'.format(file=file, output_path=output_path, output_folder_name=output_folder_name, basename=basename)
print(combi_args)
f = open(file+".txt", "r")
content = f.read()
print(content)
f.close()
combine = subprocess.Popen(combi_args)
combi_results = combine.wait()
os.remove(file+".txt")
input("press enter to exit")

11
rich_parser.py Normal file
View File

@@ -0,0 +1,11 @@
def search_file(file_path, word):
with open(file_path, 'r') as file:
for line in reversed(file.readlines()):
if word in line:
return line
speed = search_file('E:/Projects/python/ffmpeg_work_folder/testoutprogress.txt', 'speed=')
frame = search_file('E:/Projects/python/ffmpeg_work_folder/testoutprogress.txt', 'frame=')
print(speed)
print(frame)

209
rich_rpc.py Normal file
View File

@@ -0,0 +1,209 @@
# inclided from https://github.com/suclearnub/python-discord-rpc
# References:
# * https://github.com/devsnek/discord-rpc/tree/master/src/transports/IPC.js
# * https://github.com/devsnek/discord-rpc/tree/master/example/main.js
# * https://github.com/discordapp/discord-rpc/tree/master/documentation/hard-mode.md
# * https://github.com/discordapp/discord-rpc/tree/master/src
# * https://discordapp.com/developers/docs/rich-presence/how-to#updating-presence-update-presence-payload-fields
from abc import ABCMeta, abstractmethod
import json
import logging
import os
import socket
import sys
import struct
import uuid
OP_HANDSHAKE = 0
OP_FRAME = 1
OP_CLOSE = 2
OP_PING = 3
OP_PONG = 4
logger = logging.getLogger(__name__)
class DiscordIpcError(Exception):
pass
class DiscordIpcClient(metaclass=ABCMeta):
"""Work with an open Discord instance via its JSON IPC for its rich presence API.
In a blocking way.
Classmethod `for_platform`
will resolve to one of WinDiscordIpcClient or UnixDiscordIpcClient,
depending on the current platform.
Supports context handler protocol.
"""
def __init__(self, client_id):
self.client_id = client_id
self._connect()
self._do_handshake()
logger.info("connected via ID %s", client_id)
@classmethod
def for_platform(cls, client_id, platform=sys.platform):
if platform == 'win32':
return WinDiscordIpcClient(client_id)
else:
return UnixDiscordIpcClient(client_id)
@abstractmethod
def _connect(self):
pass
def _do_handshake(self):
ret_op, ret_data = self.send_recv({'v': 1, 'client_id': self.client_id}, op=OP_HANDSHAKE)
# {'cmd': 'DISPATCH', 'data': {'v': 1, 'config': {...}}, 'evt': 'READY', 'nonce': None}
if ret_op == OP_FRAME and ret_data['cmd'] == 'DISPATCH' and ret_data['evt'] == 'READY':
return
else:
if ret_op == OP_CLOSE:
self.close()
raise RuntimeError(ret_data)
@abstractmethod
def _write(self, date: bytes):
pass
@abstractmethod
def _recv(self, size: int) -> bytes:
pass
def _recv_header(self) -> (int, int):
header = self._recv_exactly(8)
return struct.unpack("<II", header)
def _recv_exactly(self, size) -> bytes:
buf = b""
size_remaining = size
while size_remaining:
chunk = self._recv(size_remaining)
buf += chunk
size_remaining -= len(chunk)
return buf
def close(self):
logger.warning("closing connection")
try:
self.send({}, op=OP_CLOSE)
finally:
self._close()
@abstractmethod
def _close(self):
pass
def __enter__(self):
return self
def __exit__(self, *_):
self.close()
def send_recv(self, data, op=OP_FRAME):
self.send(data, op)
return self.recv()
def send(self, data, op=OP_FRAME):
logger.debug("sending %s", data)
data_str = json.dumps(data, separators=(',', ':'))
data_bytes = data_str.encode('utf-8')
header = struct.pack("<II", op, len(data_bytes))
self._write(header)
self._write(data_bytes)
def recv(self) -> (int, "JSON"):
"""Receives a packet from discord.
Returns op code and payload.
"""
op, length = self._recv_header()
payload = self._recv_exactly(length)
data = json.loads(payload.decode('utf-8'))
logger.debug("received %s", data)
return op, data
def set_activity(self, act):
# act
data = {
'cmd': 'SET_ACTIVITY',
'args': {'pid': os.getpid(),
'activity': act},
'nonce': str(uuid.uuid4())
}
self.send(data)
class WinDiscordIpcClient(DiscordIpcClient):
_pipe_pattern = R'\\?\pipe\discord-ipc-{}'
def _connect(self):
for i in range(10):
path = self._pipe_pattern.format(i)
try:
self._f = open(path, "w+b")
except OSError as e:
logger.error("failed to open {!r}: {}".format(path, e))
else:
break
else:
return DiscordIpcError("Failed to connect to Discord pipe")
self.path = path
def _write(self, data: bytes):
self._f.write(data)
self._f.flush()
def _recv(self, size: int) -> bytes:
return self._f.read(size)
def _close(self):
self._f.close()
class UnixDiscordIpcClient(DiscordIpcClient):
def _connect(self):
self._sock = socket.socket(socket.AF_UNIX)
pipe_pattern = self._get_pipe_pattern()
for i in range(10):
path = pipe_pattern.format(i)
if not os.path.exists(path):
continue
try:
self._sock.connect(path)
except OSError as e:
logger.error("failed to open {!r}: {}".format(path, e))
else:
break
else:
return DiscordIpcError("Failed to connect to Discord pipe")
@staticmethod
def _get_pipe_pattern():
env_keys = ('XDG_RUNTIME_DIR', 'TMPDIR', 'TMP', 'TEMP')
for env_key in env_keys:
dir_path = os.environ.get(env_key)
if dir_path:
break
else:
dir_path = '/tmp'
return os.path.join(dir_path, 'discord-ipc-{}')
def _write(self, data: bytes):
self._sock.sendall(data)
def _recv(self, size: int) -> bytes:
return self._sock.recv(size)
def _close(self):
self._sock.close()

45
rich_rpc_copy.py Normal file
View File

@@ -0,0 +1,45 @@
import time
import json
import psutil
import pypresence
rpc = pypresence.Presence('1150714322104877108') # Put your Application ID here
data = None
rpc.connect()
def search_file(file_path, word):
with open(file_path, 'r') as file:
for line in reversed(file.readlines()):
if word in line:
return line
while True:
for proc in psutil.process_iter():
# This is an example of structural pattern matching added in Python 3.10 | Tutorial: https://www.python.org/dev/peps/pep-0636/
match proc.name().lower():
case "ffmpeg.exe":
speed = search_file('E:/Projects/python/ffmpeg_work_folder/testoutprogress.txt', 'speed=')
frame = search_file('E:/Projects/python/ffmpeg_work_folder/testoutprogress.txt', 'frame=')
state_string = speed + "@ " + frame
d = {"state": state_string, "details": "encoding"}
with open("E:/Projects/python/ffmpeg_work_folder/testoutprogress.txt", 'r+') as file:
file.truncate(0)
data = d
break
case "itunes.exe":
data = {"state": "XYZ", "details": "Zoom", "large_image": "foo", "large_text": "bar"}
break
case _:
data = None
# You don't have to update the status like this, you could do it in the for loop or call a different function to do it.
if data:
rpc.update(**data)
else:
rpc.clear()
time.sleep(15)

3
rich_text.txt Normal file
View File

@@ -0,0 +1,3 @@
{
"state": "speed 0.7x @ frame 3072", "details": "encoding"
}

58
screenshot_drop_subs.py Normal file
View File

@@ -0,0 +1,58 @@
import re
import subprocess
import sys
from pathlib import Path
import os
output_folder_name = "/screenshots/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
#Must be run with input file in the same location as script/ffmpeg, no spaces in filename
#droppedFile = ['test_source.mkv']
#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)
number_of_ss=int(input("Number of ss: "))
print(number_of_ss)
for i, file in enumerate(arguments):
arg_list = 'ffprobe.exe -show_entries format=duration -i "{file}"'.format(file=file)
print(arg_list)
cmd = subprocess.Popen(arg_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
subprocess_std = cmd.communicate()[0]
print("stdout printing: " , subprocess_std)
video_duration = [int(s) for s in re.findall(r"[0-9]+", subprocess_std)][0]
print("video_duration: ", video_duration, "s")
duration_percent = video_duration / 100
print(duration_percent)
time = duration_percent * 15
skip = ((duration_percent * 90) - (duration_percent* 15)) / (number_of_ss -1)
for i in range(0, number_of_ss):
basename = os.path.basename(file)
args = 'ffmpeg.exe -ss {time} -copyts -itsoffset -2 -i "{file}" -vf subtitles={basename} -frames:v 1 -q:v 1 "{output_path}{output_folder_name}{basename}{i}.jpeg"'.format(time=skip*i+time, file=file, output_path=output_path, output_folder_name=output_folder_name, basename=basename, i=i)
print(args)
run = subprocess.Popen(args)
print('\n')
input("press enter to exit")

BIN
screenshots/takt.mkv0.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

BIN
screenshots/takt.mkv1.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

BIN
screenshots/takt.mkv2.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

BIN
screenshots/takt.mkv3.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

BIN
screenshots/takt.mkv4.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

View File

@@ -24,7 +24,7 @@ sub_list = []
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv)', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]

1
test.txt Normal file
View File

@@ -0,0 +1 @@
E:\Projects\python\ffmpeg_collection\sauce.mp4

6767
test/bitrate_graph.c Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

128
test/bitrate_graph.pyx Normal file
View File

@@ -0,0 +1,128 @@
import subprocess
import sys
from pathlib import Path
import os
import re
import numpy as np
from matplotlib import pyplot as plt
output_folder_name ="/bulk_convert_out/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
originalfiles = sys.orig_argv[2:]
size_list=[]
time_list=[]
seconds_list=[]
summed_list=[]
duration=""
#originalfiles = ['E:\\Shadowplay\\Returnal\\test.mov']
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]
#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)
ffprobe_args = '.\\ffprobe.exe -select_streams v:0 -show_streams -i "{file}" -show_entries stream=duration:frame=pkt_size,pkt_pts_time'.format(file=listed[0])
print(ffprobe_args)
ffprobe = subprocess.Popen(["powershell.exe", ffprobe_args], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
for line in iter(ffprobe.stdout.readline,""):
time_in = re.findall('(?<=pkt_pts_time=).*',line)
size_in = re.findall('(?<=pkt_size=).*',line)
for each in time_in:
time_list.append(float(each))
for each in size_in:
size_list.append(float(each)/1024)
#time_list = time_list + time_in
#size_list = size_list + size_in
num_time = len(time_list)
num_size = len(size_list)
duration = time_list[num_time-1]
print("duration: ", duration)
print("time length: ", num_time)
print("size length:" , num_size)
def sum_seconds(list, x):
for each in list:
if each <= x:
pass
else:
highest_index = time_list.index(each)
return(int(highest_index))
a=0
b=len(time_list)
x=1
while x < duration+1:
outp = sum_seconds(time_list[a:b], x)
x+=1
seconds_list.append(outp)
#print(outp)
if x < duration+1:
summed_list.append(sum(size_list[a:outp]))
#print("summed list: ", summed_list)
a=outp
#print(summed_list)
length=len(summed_list)
newl=range(length)
print(length)
print(sum(summed_list))
print(sum(size_list))
#print(time_list)
#print("printing out", ffprobe_out)
#plt.plot(size_list, time_list)
#plt.show()
#print(type(time))
#print(time[1:2])
fig, ax = plt.subplots()
ax.plot(newl, summed_list)
ax.set(xlabel='time', ylabel='KBps', label="test")
plt.fill_between(newl, summed_list)
plt.ticklabel_format(style='plain')
plt.title(listed[0])
plt.axhline(y=np.nanmean(summed_list), color='red', linestyle='--', label='Avg: '+str(round(np.nanmean(summed_list)))+'KBps')
plt.grid()
plt.margins(0)
plt.legend()
plt.show()
#k=input("press close to exit")
#to question
# If I sum up all the frame bytes, and convert byte -> MebiByte (because windows says MegaByte but means Mebi, because MS), it is ~identical to file size in windows.
# So, why does my graph, that tracks nmcoder correctly, shows a much higher value? Nmcoder peaks at ~67725k, while mine peaks at

4
test/setup.py Normal file
View File

@@ -0,0 +1,4 @@
import distutils.core
import Cython.Build
distutils.core.setup(
ext_modules = Cython.Build.cythonize("bitrate_graph.pyx"))

1
test/test.py Normal file
View File

@@ -0,0 +1 @@
import bitrate_graph

11
testing.py Normal file
View File

@@ -0,0 +1,11 @@
class Doggo:
def __init__(totallyself, legs, coat):
totallyself.legs = legs
totallyself.coat = coat
def funcd(dog):
print("oh noes a doggo with " + dog.legs + "legs and with " + dog.coat + " fur")
woof = Doggo("4", "yellow")
woof.funcd()

47
trim_video_drop.py Normal file
View File

@@ -0,0 +1,47 @@
import subprocess
import sys
from pathlib import Path
import os
import re
output_folder_name ="/bulk_convert_out/"
droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name
originalfiles = sys.orig_argv[2:]
#long path shenanigans
joined = (' '.join(originalfiles))
re.sub (' +', ' ', joined)
listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
listed = list(filter(None, listed))
listed = [i.lstrip() for i in listed]
print(droppedName)
#get path of script location and remove the tail
head_tail = os.path.split(sys.argv[0])
output_path = head_tail[0]
from_time = input("start point (second)")
to_time = input("end point (second)")
#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)
for file in listed:
splitter = os.path.split(file)
file_folder = splitter[0]
basename = os.path.basename(file)
print(file)
args = 'ffmpeg.exe -i "{file}" -ss {from_time} -c:v libx264 -crf 18 -to {to_time} -c:a copy "{file_folder}/trimmed_{basename}" '.format(file=file, from_time=from_time, to_time=to_time, file_folder=file_folder, output_path=output_path, output_folder_name=output_folder_name, basename=basename)
print(args)
subprocess.run(args)
k=input("press close to exit")

BIN
trimmed_sauce.webm Normal file

Binary file not shown.

BIN
trimmed_test.webm Normal file

Binary file not shown.

67
vmaf.log Normal file
View File

@@ -0,0 +1,67 @@
<VMAF version="23d3bb6">
<params qualityWidth="1920" qualityHeight="1080" />
<fyi fps="60.69" />
<frames>
<frame frameNum="0" psnr_y="41.317699" psnr_cb="54.275851" psnr_cr="46.999665" integer_motion2="0.000000" integer_motion="0.000000" float_ssim="0.996418" integer_adm2="0.966019" integer_adm_scale0="0.986454" integer_adm_scale1="0.962243" integer_adm_scale2="0.946522" integer_adm_scale3="0.954971" integer_vif_scale0="0.872082" integer_vif_scale1="0.993935" integer_vif_scale2="0.997562" integer_vif_scale3="0.997814" vmaf="89.701539" />
<frame frameNum="1" psnr_y="30.306676" psnr_cb="51.684108" psnr_cr="35.713523" integer_motion2="0.210613" integer_motion="0.210613" float_ssim="0.989075" integer_adm2="0.621338" integer_adm_scale0="0.968287" integer_adm_scale1="0.824788" integer_adm_scale2="0.577747" integer_adm_scale3="0.321153" integer_vif_scale0="0.867879" integer_vif_scale1="0.983043" integer_vif_scale2="0.986590" integer_vif_scale3="0.986356" vmaf="19.653498" />
<frame frameNum="2" psnr_y="24.842045" psnr_cb="50.073915" psnr_cr="30.108785" integer_motion2="0.621372" integer_motion="0.621372" float_ssim="0.977665" integer_adm2="0.539559" integer_adm_scale0="0.953560" integer_adm_scale1="0.704437" integer_adm_scale2="0.422265" integer_adm_scale3="0.326896" integer_vif_scale0="0.838798" integer_vif_scale1="0.949960" integer_vif_scale2="0.950183" integer_vif_scale3="0.944344" vmaf="2.082357" />
<frame frameNum="3" psnr_y="22.726890" psnr_cb="47.738629" psnr_cr="27.929450" integer_motion2="1.745267" integer_motion="1.745267" float_ssim="0.967443" integer_adm2="0.513509" integer_adm_scale0="0.932592" integer_adm_scale1="0.654681" integer_adm_scale2="0.403073" integer_adm_scale3="0.358177" integer_vif_scale0="0.805162" integer_vif_scale1="0.920648" integer_vif_scale2="0.918527" integer_vif_scale3="0.907466" vmaf="0.000000" />
<frame frameNum="4" psnr_y="22.109615" psnr_cb="46.569471" psnr_cr="27.317031" integer_motion2="2.724404" integer_motion="2.724404" float_ssim="0.954214" integer_adm2="0.454183" integer_adm_scale0="0.928173" integer_adm_scale1="0.638537" integer_adm_scale2="0.363429" integer_adm_scale3="0.270038" integer_vif_scale0="0.773054" integer_vif_scale1="0.888597" integer_vif_scale2="0.885648" integer_vif_scale3="0.870119" vmaf="0.000000" />
<frame frameNum="5" psnr_y="21.328307" psnr_cb="45.314154" psnr_cr="26.691961" integer_motion2="3.278307" integer_motion="3.278307" float_ssim="0.940051" integer_adm2="0.487291" integer_adm_scale0="0.920132" integer_adm_scale1="0.634470" integer_adm_scale2="0.429389" integer_adm_scale3="0.317693" integer_vif_scale0="0.740557" integer_vif_scale1="0.846999" integer_vif_scale2="0.844647" integer_vif_scale3="0.828969" vmaf="0.000000" />
<frame frameNum="6" psnr_y="20.269412" psnr_cb="43.732763" psnr_cr="25.915661" integer_motion2="4.102540" integer_motion="4.102540" float_ssim="0.921060" integer_adm2="0.466246" integer_adm_scale0="0.918076" integer_adm_scale1="0.662283" integer_adm_scale2="0.409199" integer_adm_scale3="0.279132" integer_vif_scale0="0.690241" integer_vif_scale1="0.801838" integer_vif_scale2="0.801422" integer_vif_scale3="0.786666" vmaf="0.000000" />
<frame frameNum="7" psnr_y="19.638403" psnr_cb="43.510257" psnr_cr="25.153919" integer_motion2="5.314258" integer_motion="5.314258" float_ssim="0.911344" integer_adm2="0.506502" integer_adm_scale0="0.923064" integer_adm_scale1="0.680802" integer_adm_scale2="0.471058" integer_adm_scale3="0.345009" integer_vif_scale0="0.637263" integer_vif_scale1="0.742241" integer_vif_scale2="0.747007" integer_vif_scale3="0.736533" vmaf="0.000000" />
<frame frameNum="8" psnr_y="18.970632" psnr_cb="43.229050" psnr_cr="24.803973" integer_motion2="5.767444" integer_motion="5.767444" float_ssim="0.901487" integer_adm2="0.540985" integer_adm_scale0="0.915339" integer_adm_scale1="0.643945" integer_adm_scale2="0.470489" integer_adm_scale3="0.444182" integer_vif_scale0="0.588493" integer_vif_scale1="0.697197" integer_vif_scale2="0.705123" integer_vif_scale3="0.698754" vmaf="0.000000" />
<frame frameNum="9" psnr_y="19.017692" psnr_cb="43.628717" psnr_cr="25.330185" integer_motion2="6.718701" integer_motion="6.726403" float_ssim="0.905336" integer_adm2="0.626899" integer_adm_scale0="0.913993" integer_adm_scale1="0.710464" integer_adm_scale2="0.581296" integer_adm_scale3="0.555178" integer_vif_scale0="0.569172" integer_vif_scale1="0.681777" integer_vif_scale2="0.690308" integer_vif_scale3="0.686539" vmaf="3.317177" />
<frame frameNum="10" psnr_y="20.190193" psnr_cb="44.770699" psnr_cr="26.136580" integer_motion2="5.218411" integer_motion="6.718701" float_ssim="0.916995" integer_adm2="0.649339" integer_adm_scale0="0.924413" integer_adm_scale1="0.742065" integer_adm_scale2="0.639875" integer_adm_scale3="0.563604" integer_vif_scale0="0.569854" integer_vif_scale1="0.679726" integer_vif_scale2="0.689585" integer_vif_scale3="0.687479" vmaf="5.448622" />
<frame frameNum="11" psnr_y="19.768983" psnr_cb="43.478984" psnr_cr="25.352961" integer_motion2="5.218411" integer_motion="5.218411" float_ssim="0.915553" integer_adm2="0.734466" integer_adm_scale0="0.932969" integer_adm_scale1="0.819120" integer_adm_scale2="0.726640" integer_adm_scale3="0.666889" integer_vif_scale0="0.545584" integer_vif_scale1="0.668252" integer_vif_scale2="0.680583" integer_vif_scale3="0.678076" vmaf="19.352454" />
<frame frameNum="12" psnr_y="19.456851" psnr_cb="43.293668" psnr_cr="24.963384" integer_motion2="5.673709" integer_motion="5.673709" float_ssim="0.914718" integer_adm2="0.684084" integer_adm_scale0="0.917855" integer_adm_scale1="0.768515" integer_adm_scale2="0.683293" integer_adm_scale3="0.607993" integer_vif_scale0="0.528773" integer_vif_scale1="0.643634" integer_vif_scale2="0.654368" integer_vif_scale3="0.652262" vmaf="10.035389" />
<frame frameNum="13" psnr_y="19.821912" psnr_cb="44.642577" psnr_cr="25.489694" integer_motion2="5.798300" integer_motion="6.010232" float_ssim="0.914069" integer_adm2="0.652846" integer_adm_scale0="0.913108" integer_adm_scale1="0.718434" integer_adm_scale2="0.622541" integer_adm_scale3="0.598855" integer_vif_scale0="0.513524" integer_vif_scale1="0.640613" integer_vif_scale2="0.653635" integer_vif_scale3="0.652966" vmaf="5.279805" />
<frame frameNum="14" psnr_y="20.593435" psnr_cb="44.802240" psnr_cr="26.368687" integer_motion2="4.889728" integer_motion="5.798300" float_ssim="0.915412" integer_adm2="0.644635" integer_adm_scale0="0.929199" integer_adm_scale1="0.780699" integer_adm_scale2="0.634923" integer_adm_scale3="0.544045" integer_vif_scale0="0.540289" integer_vif_scale1="0.669130" integer_vif_scale2="0.682987" integer_vif_scale3="0.682056" vmaf="4.295147" />
<frame frameNum="15" psnr_y="20.023957" psnr_cb="44.287305" psnr_cr="26.105854" integer_motion2="4.889728" integer_motion="4.889728" float_ssim="0.912734" integer_adm2="0.684513" integer_adm_scale0="0.952500" integer_adm_scale1="0.763827" integer_adm_scale2="0.630109" integer_adm_scale3="0.631776" integer_vif_scale0="0.548571" integer_vif_scale1="0.688814" integer_vif_scale2="0.702006" integer_vif_scale3="0.699937" vmaf="11.707987" />
<frame frameNum="16" psnr_y="20.580884" psnr_cb="45.108544" psnr_cr="27.236441" integer_motion2="5.124421" integer_motion="5.266569" float_ssim="0.912204" integer_adm2="0.725369" integer_adm_scale0="0.955329" integer_adm_scale1="0.793170" integer_adm_scale2="0.736121" integer_adm_scale3="0.643189" integer_vif_scale0="0.532308" integer_vif_scale1="0.678704" integer_vif_scale2="0.689091" integer_vif_scale3="0.682764" vmaf="17.970423" />
<frame frameNum="17" psnr_y="21.021838" psnr_cb="45.781378" psnr_cr="28.063066" integer_motion2="4.786767" integer_motion="5.124421" float_ssim="0.917411" integer_adm2="0.732985" integer_adm_scale0="0.980746" integer_adm_scale1="0.834659" integer_adm_scale2="0.736497" integer_adm_scale3="0.641852" integer_vif_scale0="0.531256" integer_vif_scale1="0.678084" integer_vif_scale2="0.689394" integer_vif_scale3="0.685784" vmaf="19.125498" />
<frame frameNum="18" psnr_y="22.028636" psnr_cb="45.900289" psnr_cr="28.807485" integer_motion2="4.081622" integer_motion="4.786767" float_ssim="0.920201" integer_adm2="0.732976" integer_adm_scale0="0.978994" integer_adm_scale1="0.830142" integer_adm_scale2="0.717345" integer_adm_scale3="0.657003" integer_vif_scale0="0.540408" integer_vif_scale1="0.686961" integer_vif_scale2="0.698488" integer_vif_scale3="0.696374" vmaf="18.978733" />
<frame frameNum="19" psnr_y="21.537800" psnr_cb="45.354720" psnr_cr="27.497775" integer_motion2="4.081622" integer_motion="4.081622" float_ssim="0.915940" integer_adm2="0.710041" integer_adm_scale0="0.925896" integer_adm_scale1="0.836719" integer_adm_scale2="0.713134" integer_adm_scale3="0.612302" integer_vif_scale0="0.536029" integer_vif_scale1="0.687171" integer_vif_scale2="0.701404" integer_vif_scale3="0.701190" vmaf="15.345257" />
<frame frameNum="20" psnr_y="20.362708" psnr_cb="43.470513" psnr_cr="26.037763" integer_motion2="4.386219" integer_motion="4.386219" float_ssim="0.904362" integer_adm2="0.719705" integer_adm_scale0="0.937220" integer_adm_scale1="0.800789" integer_adm_scale2="0.701464" integer_adm_scale3="0.646661" integer_vif_scale0="0.536709" integer_vif_scale1="0.686109" integer_vif_scale2="0.701468" integer_vif_scale3="0.699432" vmaf="17.242858" />
<frame frameNum="21" psnr_y="18.350522" psnr_cb="43.983320" psnr_cr="25.601277" integer_motion2="5.783196" integer_motion="5.783196" float_ssim="0.899806" integer_adm2="0.733143" integer_adm_scale0="0.948681" integer_adm_scale1="0.754907" integer_adm_scale2="0.702716" integer_adm_scale3="0.690470" integer_vif_scale0="0.541616" integer_vif_scale1="0.693409" integer_vif_scale2="0.706626" integer_vif_scale3="0.702778" vmaf="21.195134" />
<frame frameNum="22" psnr_y="12.878004" psnr_cb="43.394380" psnr_cr="25.923381" integer_motion2="7.620749" integer_motion="7.620749" float_ssim="0.803410" integer_adm2="0.674384" integer_adm_scale0="0.961021" integer_adm_scale1="0.772583" integer_adm_scale2="0.636971" integer_adm_scale3="0.598259" integer_vif_scale0="0.515843" integer_vif_scale1="0.654891" integer_vif_scale2="0.663928" integer_vif_scale3="0.658186" vmaf="10.687903" />
<frame frameNum="23" psnr_y="7.512868" psnr_cb="43.165551" psnr_cr="26.371077" integer_motion2="24.381536" integer_motion="24.381536" float_ssim="0.522134" integer_adm2="0.641121" integer_adm_scale0="0.962522" integer_adm_scale1="0.743597" integer_adm_scale2="0.620246" integer_adm_scale3="0.545466" integer_vif_scale0="0.330955" integer_vif_scale1="0.460968" integer_vif_scale2="0.471670" integer_vif_scale3="0.453817" vmaf="17.356446" />
<frame frameNum="24" psnr_y="8.226348" psnr_cb="40.803181" psnr_cr="24.394323" integer_motion2="74.596275" integer_motion="81.392044" float_ssim="0.467722" integer_adm2="0.444639" integer_adm_scale0="0.878493" integer_adm_scale1="0.567195" integer_adm_scale2="0.387930" integer_adm_scale3="0.350721" integer_vif_scale0="0.215310" integer_vif_scale1="0.255175" integer_vif_scale2="0.251434" integer_vif_scale3="0.232572" vmaf="52.170940" />
<frame frameNum="25" psnr_y="11.360010" psnr_cb="39.781726" psnr_cr="27.535776" integer_motion2="37.383488" integer_motion="74.596275" float_ssim="0.646120" integer_adm2="0.443340" integer_adm_scale0="0.841199" integer_adm_scale1="0.520536" integer_adm_scale2="0.400927" integer_adm_scale3="0.349066" integer_vif_scale0="0.290304" integer_vif_scale1="0.346358" integer_vif_scale2="0.345907" integer_vif_scale3="0.327284" vmaf="10.093762" />
<frame frameNum="26" psnr_y="15.376870" psnr_cb="30.483564" psnr_cr="24.276161" integer_motion2="17.787590" integer_motion="37.383488" float_ssim="0.743315" integer_adm2="0.613737" integer_adm_scale0="0.918370" integer_adm_scale1="0.717968" integer_adm_scale2="0.593002" integer_adm_scale3="0.509053" integer_vif_scale0="0.413449" integer_vif_scale1="0.501751" integer_vif_scale2="0.503114" integer_vif_scale3="0.486306" vmaf="7.097159" />
<frame frameNum="27" psnr_y="15.618170" psnr_cb="27.710098" psnr_cr="21.708673" integer_motion2="17.387087" integer_motion="17.787590" float_ssim="0.729008" integer_adm2="0.552473" integer_adm_scale0="0.916175" integer_adm_scale1="0.724343" integer_adm_scale2="0.542035" integer_adm_scale3="0.424316" integer_vif_scale0="0.373831" integer_vif_scale1="0.449311" integer_vif_scale2="0.446624" integer_vif_scale3="0.432311" vmaf="0.000000" />
<frame frameNum="28" psnr_y="15.800120" psnr_cb="26.870049" psnr_cr="21.575515" integer_motion2="16.291241" integer_motion="17.387087" float_ssim="0.723962" integer_adm2="0.501634" integer_adm_scale0="0.920683" integer_adm_scale1="0.677602" integer_adm_scale2="0.478439" integer_adm_scale3="0.376148" integer_vif_scale0="0.348891" integer_vif_scale1="0.430394" integer_vif_scale2="0.431539" integer_vif_scale3="0.419488" vmaf="0.000000" />
<frame frameNum="29" psnr_y="15.760153" psnr_cb="27.485814" psnr_cr="22.218719" integer_motion2="16.018944" integer_motion="16.291241" float_ssim="0.722141" integer_adm2="0.444918" integer_adm_scale0="0.884532" integer_adm_scale1="0.589026" integer_adm_scale2="0.391102" integer_adm_scale3="0.352928" integer_vif_scale0="0.322871" integer_vif_scale1="0.399414" integer_vif_scale2="0.400346" integer_vif_scale3="0.391919" vmaf="0.000000" />
<frame frameNum="30" psnr_y="16.538971" psnr_cb="27.972343" psnr_cr="22.468528" integer_motion2="15.621269" integer_motion="16.018944" float_ssim="0.683741" integer_adm2="0.493718" integer_adm_scale0="0.889058" integer_adm_scale1="0.621560" integer_adm_scale2="0.446425" integer_adm_scale3="0.401731" integer_vif_scale0="0.314704" integer_vif_scale1="0.393709" integer_vif_scale2="0.397055" integer_vif_scale3="0.389329" vmaf="0.000000" />
<frame frameNum="31" psnr_y="16.973430" psnr_cb="26.829439" psnr_cr="21.669765" integer_motion2="15.621269" integer_motion="15.621269" float_ssim="0.603820" integer_adm2="0.474098" integer_adm_scale0="0.875645" integer_adm_scale1="0.588429" integer_adm_scale2="0.429209" integer_adm_scale3="0.386870" integer_vif_scale0="0.268415" integer_vif_scale1="0.333022" integer_vif_scale2="0.332427" integer_vif_scale3="0.320401" vmaf="0.000000" />
<frame frameNum="32" psnr_y="15.918653" psnr_cb="24.962687" psnr_cr="20.495387" integer_motion2="18.204660" integer_motion="18.204660" float_ssim="0.551369" integer_adm2="0.494921" integer_adm_scale0="0.881296" integer_adm_scale1="0.577575" integer_adm_scale2="0.439566" integer_adm_scale3="0.423891" integer_vif_scale0="0.247391" integer_vif_scale1="0.306220" integer_vif_scale2="0.306986" integer_vif_scale3="0.294096" vmaf="0.000000" />
<frame frameNum="33" psnr_y="14.485848" psnr_cb="22.477455" psnr_cr="19.083819" integer_motion2="23.727013" integer_motion="23.727013" float_ssim="0.504626" integer_adm2="0.495010" integer_adm_scale0="0.874654" integer_adm_scale1="0.571975" integer_adm_scale2="0.445930" integer_adm_scale3="0.424697" integer_vif_scale0="0.226326" integer_vif_scale1="0.273502" integer_vif_scale2="0.272845" integer_vif_scale3="0.261190" vmaf="5.541754" />
<frame frameNum="34" psnr_y="13.433194" psnr_cb="20.054209" psnr_cr="17.478856" integer_motion2="30.884609" integer_motion="30.884609" float_ssim="0.458797" integer_adm2="0.499242" integer_adm_scale0="0.884351" integer_adm_scale1="0.583655" integer_adm_scale2="0.456941" integer_adm_scale3="0.418444" integer_vif_scale0="0.207793" integer_vif_scale1="0.250784" integer_vif_scale2="0.251919" integer_vif_scale3="0.241783" vmaf="13.305412" />
<frame frameNum="35" psnr_y="12.774691" psnr_cb="18.780252" psnr_cr="16.724898" integer_motion2="37.334209" integer_motion="37.334209" float_ssim="0.454398" integer_adm2="0.514760" integer_adm_scale0="0.867989" integer_adm_scale1="0.561647" integer_adm_scale2="0.443096" integer_adm_scale3="0.473161" integer_vif_scale0="0.192385" integer_vif_scale1="0.230857" integer_vif_scale2="0.233281" integer_vif_scale3="0.225018" vmaf="21.274786" />
<frame frameNum="36" psnr_y="12.363394" psnr_cb="18.328822" psnr_cr="16.497458" integer_motion2="40.829010" integer_motion="40.829010" float_ssim="0.473594" integer_adm2="0.512266" integer_adm_scale0="0.870382" integer_adm_scale1="0.532647" integer_adm_scale2="0.441811" integer_adm_scale3="0.477559" integer_vif_scale0="0.194354" integer_vif_scale1="0.234093" integer_vif_scale2="0.239254" integer_vif_scale3="0.233529" vmaf="23.923099" />
<frame frameNum="37" psnr_y="11.690288" psnr_cb="17.862198" psnr_cr="15.970006" integer_motion2="43.140625" integer_motion="43.140625" float_ssim="0.444455" integer_adm2="0.511719" integer_adm_scale0="0.865319" integer_adm_scale1="0.537808" integer_adm_scale2="0.438115" integer_adm_scale3="0.475486" integer_vif_scale0="0.198925" integer_vif_scale1="0.239420" integer_vif_scale2="0.242857" integer_vif_scale3="0.234984" vmaf="25.698291" />
<frame frameNum="38" psnr_y="12.183337" psnr_cb="17.742065" psnr_cr="16.413819" integer_motion2="43.595383" integer_motion="48.424339" float_ssim="0.499681" integer_adm2="0.528843" integer_adm_scale0="0.869598" integer_adm_scale1="0.526870" integer_adm_scale2="0.472312" integer_adm_scale3="0.493096" integer_vif_scale0="0.205238" integer_vif_scale1="0.249142" integer_vif_scale2="0.252500" integer_vif_scale3="0.244666" vmaf="27.091291" />
<frame frameNum="39" psnr_y="12.658015" psnr_cb="17.528886" psnr_cr="16.852592" integer_motion2="39.157398" integer_motion="43.595383" float_ssim="0.525124" integer_adm2="0.563123" integer_adm_scale0="0.878706" integer_adm_scale1="0.562536" integer_adm_scale2="0.502919" integer_adm_scale3="0.534673" integer_vif_scale0="0.215996" integer_vif_scale1="0.262353" integer_vif_scale2="0.267658" integer_vif_scale3="0.262801" vmaf="25.724763" />
<frame frameNum="40" psnr_y="12.910202" psnr_cb="17.399576" psnr_cr="17.183088" integer_motion2="36.982841" integer_motion="39.157398" float_ssim="0.519940" integer_adm2="0.591053" integer_adm_scale0="0.899164" integer_adm_scale1="0.595069" integer_adm_scale2="0.555413" integer_adm_scale3="0.542545" integer_vif_scale0="0.223778" integer_vif_scale1="0.269032" integer_vif_scale2="0.272064" integer_vif_scale3="0.262129" vmaf="26.306058" />
<frame frameNum="41" psnr_y="12.982009" psnr_cb="17.085389" psnr_cr="17.331535" integer_motion2="36.982841" integer_motion="36.982841" float_ssim="0.506723" integer_adm2="0.578528" integer_adm_scale0="0.879466" integer_adm_scale1="0.605574" integer_adm_scale2="0.547552" integer_adm_scale3="0.519170" integer_vif_scale0="0.225653" integer_vif_scale1="0.269238" integer_vif_scale2="0.269857" integer_vif_scale3="0.257484" vmaf="25.052645" />
</frames>
<pooled_metrics>
<metric name="psnr_y" min="7.512868" max="41.317699" mean="17.897849" harmonic_mean="16.300333" />
<metric name="psnr_cb" min="17.085389" max="54.275851" mean="36.460687" harmonic_mean="31.926994" />
<metric name="psnr_cr" min="15.970006" max="46.999665" mean="24.423774" harmonic_mean="23.311720" />
<metric name="integer_motion2" min="0.000000" max="74.596275" mean="16.284835" harmonic_mean="5.178686" />
<metric name="integer_motion" min="0.000000" max="81.392044" mean="18.214019" harmonic_mean="5.317970" />
<metric name="float_ssim" min="0.444455" max="0.996418" mean="0.762085" harmonic_mean="0.739927" />
<metric name="integer_adm2" min="0.443340" max="0.966019" mean="0.588099" harmonic_mean="0.580712" />
<metric name="integer_adm_scale0" min="0.841199" max="0.986454" mean="0.916076" harmonic_mean="0.915413" />
<metric name="integer_adm_scale1" min="0.520536" max="0.962243" mean="0.684236" harmonic_mean="0.677653" />
<metric name="integer_adm_scale2" min="0.363429" max="0.946522" mean="0.547359" harmonic_mean="0.536844" />
<metric name="integer_adm_scale3" min="0.270038" max="0.954971" mean="0.494151" harmonic_mean="0.481867" />
<metric name="integer_vif_scale0" min="0.192385" max="0.872082" mean="0.461429" harmonic_mean="0.433205" />
<metric name="integer_vif_scale1" min="0.230857" max="0.993935" mean="0.557535" harmonic_mean="0.521653" />
<metric name="integer_vif_scale2" min="0.233281" max="0.997562" mean="0.562617" harmonic_mean="0.526227" />
<metric name="integer_vif_scale3" min="0.225018" max="0.997814" mean="0.554618" harmonic_mean="0.517322" />
<metric name="vmaf" min="0.000000" max="89.701539" mean="13.620385" harmonic_mean="1.893287" />
</pooled_metrics>
<aggregate_metrics />
</VMAF>

50
vmaf_drop.py Normal file
View File

@@ -0,0 +1,50 @@
import subprocess
import sys
from pathlib import Path
import os
import re
#output_folder_name ="/bulk_convert_out/"
ref_video=input("reference video: ")
dist_video=input("distorted video: ")
#droppedFile = sys.argv[1]
#droppedName = Path(droppedFile).name
#originalfiles = sys.orig_argv[2:]
#long path shenanigans
#joined = (' '.join(originalfiles))
#re.sub (' +', ' ', joined)
#listed = re.split(r'(.+?mkv|.+?mov|.+?mp4)', joined)
#listed = list(filter(None, listed))
#listed = [i.lstrip() for i in listed]
#print(droppedName)
#get path of script location and remove the tail
#head_tail = os.path.split(sys.argv[0])
#output_path = head_tail[0]
#from_time = input("start point (second)")
#to_time = input("end point (second)")
#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)
#for file in listed:
#splitter = os.path.split(file)
#file_folder = splitter[0]
basename = os.path.basename(dist_video)
#print(file)
args = '.\\ffmpeg.exe -i {ref_video} -i {dist_video} -filter_complex "[0:v]scale=1920x1080:flags=bicubic[main];[1:v]scale=1920x1080:flags=bicubic[ref];[main][ref]libvmaf=feature=name=psnr|name=float_ssim:log_path=vmaf.log:n_threads=20" -f null -'.format(ref_video=ref_video, dist_video=dist_video)
print(args)
subprocess.run(args)
k=input("press close to exit")

File diff suppressed because one or more lines are too long

3191
vmaf_models/vmaf_v0.6.1.json Normal file

File diff suppressed because one or more lines are too long