From fe6b846f8d5a87019485bac6fc7faeb58ebc6637 Mon Sep 17 00:00:00 2001 From: jaydee Date: Wed, 25 Sep 2024 00:06:02 +0200 Subject: [PATCH] bitwarden --- handle_imported_video.py | 95 ++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/handle_imported_video.py b/handle_imported_video.py index 99938a5..29d3a26 100644 --- a/handle_imported_video.py +++ b/handle_imported_video.py @@ -196,52 +196,53 @@ if _ACTION == "join": os.remove("video.txt") if _ACTION == "encode": - if ops == "win": - _FULL_PATH = _SOURCE_DIR + "\\" + _DEV + "\\" + _DAY_DIR + "\\" - else: - _FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR + "/" - if os.path.exists(_FULL_PATH): - if os.path.exists(_FULL_PATH + "100GOPRO"): - _FULL_PATH = _FULL_PATH + "100GOPRO" - parts = [] - for filename in os.listdir(_FULL_PATH): - if filename.startswith("joined_") and filename.endswith(".MP4"): - parts.append(filename) - else: - sys.exit() - - - - 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", "-y", 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", "-y", export_name, "-f", "null", "/dev/null", - ] + for _DAY_DIR in _DAY_DIRS: + if ops == "win": + _FULL_PATH = _SOURCE_DIR + "\\" + _DEV + "\\" + _DAY_DIR + "\\" else: - if ops == "win": - myCmd = [ - "ffmpeg", "-i", p, "-c:v", "hevc_amf", "-rc", "cqp", "-qp_i", "42", "-qp_p", "42", "-quality", "quality", "-crf", "25", "-y", 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", "-y", 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) + _FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR + "/" + if os.path.exists(_FULL_PATH): + if os.path.exists(_FULL_PATH + "100GOPRO"): + _FULL_PATH = _FULL_PATH + "100GOPRO" + parts = [] + for filename in os.listdir(_FULL_PATH): + if filename.startswith("joined_") and filename.endswith(".MP4"): + parts.append(filename) + else: + sys.exit() + + - # 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 - - - \ No newline at end of file + 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", "-y", 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", "-y", 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", "-y", 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", "-y", 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 + + + \ No newline at end of file