mirror of
https://gitlab.sectorq.eu/jaydee/python.git
synced 2025-12-14 10:44:52 +01:00
bitwarden
This commit is contained in:
@@ -19,7 +19,7 @@ elif sys.platform == "darwin":
|
||||
elif sys.platform == "win32":
|
||||
ops = "win"
|
||||
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:
|
||||
# print help information and exit:
|
||||
print(str(err)) # will print something like "option -a not recognized"
|
||||
@@ -45,6 +45,8 @@ for o, a in opts:
|
||||
_FLIP = True
|
||||
elif o in ("-r", "--source"):
|
||||
_SOURCE_DIR = a
|
||||
elif o in ("-a", "--action"):
|
||||
_ACTION = a
|
||||
elif o in ("-s", "--sequence"):
|
||||
a = a.split(",")
|
||||
for s in a:
|
||||
@@ -62,10 +64,14 @@ if ops == "win":
|
||||
else:
|
||||
_FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR + "/"
|
||||
|
||||
|
||||
|
||||
#print(_FULL_PATH)
|
||||
|
||||
video_seq = {}
|
||||
if os.path.exists(_FULL_PATH):
|
||||
if _ACTION == "join":
|
||||
video_seq = {}
|
||||
|
||||
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):
|
||||
@@ -180,3 +186,47 @@ if os.path.exists(_FULL_PATH):
|
||||
except:
|
||||
print(f"Failed to move {p.replace("MP4", "LRV")}")
|
||||
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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user