bitwarden

This commit is contained in:
jaydee
2024-09-24 17:57:08 +02:00
parent 804292e59a
commit c3769086bc

View File

@@ -19,7 +19,7 @@ elif sys.platform == "darwin":
elif sys.platform == "win32": elif sys.platform == "win32":
ops = "win" ops = "win"
try: try:
opts, args = getopt.getopt(sys.argv[1:], "r:fp:d:s:", ["command=", "help", "output=", "backup"]) opts, args = getopt.getopt(sys.argv[1:], "a:r:fp:d:s:", ["command=", "help", "output=", "backup"])
except getopt.GetoptError as err: except getopt.GetoptError as err:
# print help information and exit: # print help information and exit:
print(str(err)) # will print something like "option -a not recognized" print(str(err)) # will print something like "option -a not recognized"
@@ -45,6 +45,8 @@ for o, a in opts:
_FLIP = True _FLIP = True
elif o in ("-r", "--source"): elif o in ("-r", "--source"):
_SOURCE_DIR = a _SOURCE_DIR = a
elif o in ("-a", "--action"):
_ACTION = a
elif o in ("-s", "--sequence"): elif o in ("-s", "--sequence"):
a = a.split(",") a = a.split(",")
for s in a: for s in a:
@@ -62,10 +64,14 @@ if ops == "win":
else: else:
_FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR + "/" _FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR + "/"
#print(_FULL_PATH) #print(_FULL_PATH)
video_seq = {} if _ACTION == "join":
if os.path.exists(_FULL_PATH): video_seq = {}
if os.path.exists(_FULL_PATH):
if os.path.exists(_FULL_PATH + "100GOPRO"): if os.path.exists(_FULL_PATH + "100GOPRO"):
_FULL_PATH = _FULL_PATH + "100GOPRO" _FULL_PATH = _FULL_PATH + "100GOPRO"
for filename in os.listdir(_FULL_PATH): for filename in os.listdir(_FULL_PATH):
@@ -180,3 +186,47 @@ if os.path.exists(_FULL_PATH):
except: except:
print(f"Failed to move {p.replace("MP4", "LRV")}") print(f"Failed to move {p.replace("MP4", "LRV")}")
os.remove("video.txt") os.remove("video.txt")
if _ACTION == "encode":
if os.path.exists(_FULL_PATH):
if os.path.exists(_FULL_PATH + "100GOPRO"):
_FULL_PATH = _FULL_PATH + "100GOPRO"
for filename in os.listdir(_FULL_PATH):
if filename.startswith("joined_") and filename.endswith(".MP4"):
parts.append(filename)
for p in parts:
export_name = "encoded_" + p
if _FLIP:
if ops == "win":
myCmd = [
"ffmpeg", "-display_rotation", "180", "-i", p, "-c:v", "hevc_amf", "-rc", "cqp", "-qp_i", "42", "-qp_p", "42", "-quality", "quality", "-crf", "25", export_name, "-f", "null", "/dev/null",
]
else:
myCmd = [
"/opt/ffmpeg/ffmpeg", "-display_rotation", "180", "-i", p, "-c:v", "hevc_amf", "-rc", "cqp", "-qp_i", "42", "-qp_p", "42", "-quality", "quality", "-crf", "25", export_name, "-f", "null", "/dev/null",
]
else:
if ops == "win":
myCmd = [
"ffmpeg", "-i", p, "-c:v", "hevc_amf", "-rc", "cqp", "-qp_i", "42", "-qp_p", "42", "-quality", "quality", "-crf", "25", export_name , "-f", "null", "/dev/null",
]
else:
myCmd = [
"/opt/ffmpeg/ffmpeg", "-i", p, "-c:v", "hevc_amf", "-rc", "cqp", "-qp_i", "42", "-qp_p", "42", "-quality", "quality", "-crf", "25", export_name , "-f", "null", "/dev/null",
]
print(myCmd)
print(f"Encoding files...")
ff = FfmpegProgress(myCmd)
with tqdm(total=100, position=1, desc="Convert") as pbar:
for progress in ff.run_command_with_progress():
pbar.update(progress - pbar.n)
# get the output
print(ff.stderr)
#ffmpeg -i .\GH010149.MP4 -c:v hevc_amf -rc cqp -qp_i 42 -qp_p 42 -quality quality -crf 25 output7.mp4