updated ffmpeg binaries, general improvements
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -7,3 +7,7 @@ test - Copy.mkv
|
||||
test.mkv
|
||||
test123.mkv
|
||||
*.jpg
|
||||
test.mkv1out.mkv
|
||||
test.mkv0out.mkv
|
||||
input.txt
|
||||
.gitignore
|
||||
|
||||
@@ -10,7 +10,7 @@ droppedName = Path(droppedFile).name
|
||||
skipto = ""
|
||||
duration = ""
|
||||
|
||||
|
||||
print(droppedName)
|
||||
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@ del sys.argv[0]
|
||||
#vid:
|
||||
|
||||
|
||||
for each in sys.argv:
|
||||
for file in sys.argv:
|
||||
i = 0
|
||||
path = each
|
||||
basename = os.path.basename(path)
|
||||
print(each)
|
||||
arguments = ( "ffmpeg.exe ", " -i ", '"', each, '"',skipto, duration, " -map 0:v ", " -c:v libx265 -preset slow -crf 21 -x265-params "'level=51:no-sao:bframes=8:psy-rd=1.5:psy-rdoq=5:aq-mode=3:ref=6'" -pix_fmt yuv420p10le ", " -map 0:a -c:a copy -map 0:s -c:s copy -f matroska ",'"',"E:/Projects/python/ffmpeg_by_textfile/out_done/", basename, '"' )
|
||||
|
||||
arg_list = "".join(map(str, arguments))
|
||||
print(arg_list)
|
||||
path = file
|
||||
basename = os.path.basename(file)
|
||||
print(file)
|
||||
#arguments = ( "ffmpeg.exe ", " -i ", '"', each, '"',skipto, duration, " -map 0:v ", ",'"',"E:/Projects/python/ffmpeg_by_textfile/out_done/", basename, '"' )
|
||||
args = 'ffmpeg.exe -i "{file}" -map 0:v -c:v libx265 -preset slow -crf 21 -x265-params level=51:no-sao:bframes=8:psy-rd=1.5:psy-rdoq=5:aq-mode=3:ref=6 -pix_fmt yuv420p10le -map 0:a -c:a copy -map 0:s -c:s copy -f matroska "E:/Projects/python/ffmpeg_quality_testing/out/{basename}"'.format(file=file, basename=basename)
|
||||
#arg_list = "".join(map(str, arguments))
|
||||
print(args)
|
||||
#print(each)
|
||||
subprocess.run(arg_list)
|
||||
subprocess.run(args)
|
||||
i += 1
|
||||
|
||||
|
||||
|
||||
37
ffprobe_drop.py
Normal file
37
ffprobe_drop.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
droppedFile = sys.argv[1]
|
||||
droppedName = Path(droppedFile).name
|
||||
|
||||
skipto = " -ss "
|
||||
|
||||
#droppedFile = "test.mkv"
|
||||
count = 0
|
||||
del sys.argv[0]
|
||||
|
||||
for each in sys.argv:
|
||||
i = 0
|
||||
|
||||
print(each)
|
||||
arguments = ( "ffprobe.exe ", " -i ", '"' , each, '"' )
|
||||
|
||||
arg_list = "".join(map(str, arguments))
|
||||
print(arg_list)
|
||||
#print(each)
|
||||
cmd = subprocess.Popen(arg_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
|
||||
subprocess_err = cmd.stderr.read()
|
||||
|
||||
#for line in subprocess_err:
|
||||
# print(line)
|
||||
print(subprocess_err)
|
||||
|
||||
|
||||
i += 1
|
||||
|
||||
|
||||
|
||||
|
||||
k=input("press close to exit")
|
||||
25
getnative_drop.py
Normal file
25
getnative_drop.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
|
||||
droppedFile = sys.argv[1]
|
||||
droppedName = Path(droppedFile).name
|
||||
del sys.argv[0]
|
||||
|
||||
for each in sys.argv:
|
||||
print(each)
|
||||
print(droppedFile)
|
||||
print(droppedName)
|
||||
args = 'py -3 -m getnative --show-plot-gui -dir "E:/Projects/python/ffmpeg_work_folder/out_search" "{each}" '.format(each=each)
|
||||
print(args)
|
||||
#print(each)
|
||||
run = subprocess.Popen(args)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
k=input("press close to exit")
|
||||
58
quality_test.py
Normal file
58
quality_test.py
Normal file
@@ -0,0 +1,58 @@
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
droppedFile = sys.argv[1]
|
||||
droppedName = Path(droppedFile).name
|
||||
|
||||
skipto = " -ss "
|
||||
|
||||
#droppedFile = ["sam_overlord_bluraysource.mkv"]
|
||||
|
||||
lines = "-map 0:v -c:v libx265 -preset slow -crf 21 -x265-params level=51:no-sao:bframes=8:psy-rd=1.5:psy-rdoq=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 libx264 -crf 0 -map 0:a -c:a copy -map 0:s -c:s copy"
|
||||
#-map 0:v -c:v libx265 -preset slow -crf 21 -x265-params level=51:no-sao:bframes=8:psy-rd=1.5:psy-rdoq=5:aq-mode=3:ref=6 -pix_fmt yuv420p10le -map 0:a -c:a copy -map 0:s -c:s copy -f
|
||||
del sys.argv[0]
|
||||
|
||||
|
||||
number_of_segments=int(input("Number of segments: "))
|
||||
segment_length=int(input("How long should each segment be(seconds)? "))
|
||||
|
||||
for i, file in enumerate(sys.argv):
|
||||
|
||||
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):
|
||||
|
||||
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 -i "{file}" -ss {time} -t {segment_length} {org_lineslines} -f matroska "{file}{i}ORIGINAL_COMP.mkv"'.format(time=skip*i+time, segment_length=segment_length, file=file, org_lineslines=org_lineslines, i=i)
|
||||
print(args)
|
||||
run = subprocess.Popen(args)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print('\n')
|
||||
|
||||
|
||||
input("press enter to exit")
|
||||
@@ -15,9 +15,9 @@ skipto = " -ss "
|
||||
|
||||
del sys.argv[0]
|
||||
|
||||
for i, each in enumerate(sys.argv):
|
||||
for i, file in enumerate(sys.argv):
|
||||
|
||||
arg_list = 'ffprobe.exe -i "{each}"'.format(each=each)
|
||||
arg_list = 'ffprobe.exe -i "{file}"'.format(file=file)
|
||||
|
||||
cmd = subprocess.Popen(arg_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
|
||||
|
||||
@@ -39,12 +39,11 @@ audio_track = "".join(" -map 0:a:{}".format(y) for y in x)
|
||||
z = (int(z) for z in input ("Enter subtitle tracks to keep: ").split())
|
||||
subtitle_track = "".join(" -map 0:s:{}".format(y) for y in z)
|
||||
|
||||
for each in sys.argv:
|
||||
for file in sys.argv:
|
||||
|
||||
path = each
|
||||
basename = os.path.basename(path)
|
||||
basename = os.path.basename(file)
|
||||
|
||||
arg_list = 'ffmpeg.exe -i "{each}" -map 0:v {audio_track} {subtitle_track} -c copy "E:/Projects/ffmpeg_tests/audio_tracks/out/{basename}"'.format(each=each, audio_track=audio_track, subtitle_track=subtitle_track, basename=basename)
|
||||
arg_list = 'ffmpeg.exe -i "{file}" -map 0:v {audio_track} {subtitle_track} -c copy "E:/Projects/ffmpeg_tests/audio_tracks/out/{basename}"'.format(file=file, audio_track=audio_track, subtitle_track=subtitle_track, basename=basename)
|
||||
|
||||
print(arg_list)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user