This commit is contained in:
2025-06-17 19:24:39 +02:00
parent 2f24e1e73f
commit 9071c8a3c0

View File

@@ -76,17 +76,22 @@ for o, a in opts:
#print(_FULL_PATH)
if _ACTION == "flip":
def flip_videos(_DEV,_SOURCE_DIR,_DAY_DIRS):
for _DAY_DIR in _DAY_DIRS:
if ops == "win":
_FULL_PATH = _SOURCE_DIR + "\\" + _DEV + "\\" + _DAY_DIR + "\\"
else:
_FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR + "/"
os.chdir(_FULL_PATH)
for filename in os.listdir(_FULL_PATH):
FPATH = _FULL_PATH + filename
print(FPATH)
if filename.endswith(".MP4") and not filename.startswith("joined_"):
create_date = filedate.File(filename).get()
print(filename)
export_name = 'flipped_' + filename
if ops == "win":
@@ -94,15 +99,18 @@ if _ACTION == "flip":
"ffmpeg", "-i", filename ,"-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name
]
else:
myCmd = [
"/usr/bin/ffmpeg", "-i", filename, "-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name
]
# myCmd = [
# "/usr/bin/ffmpeg", "-i", filename, "-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name
# ]
# myCmd = [
# "/usr/bin/ffmpeg", "-i", filename, "-vf", "transpose=2,transpose=2", "-y", export_name
# ]
# myCmd = [
# "/usr/bin/ffmpeg", "-i", filename, "-vf", "hflip", "-c:a", "copy", "-y", export_name
# "/usr/bin/ffmpeg", "-i", filename, "-vf", "hflip", "-c:a", "-codec", "copy", "-y", export_name
# ]
myCmd = [
"exiftool", "-rotation=180", filename
]
#Path = "~/Documents/File.txt"
# filedate.File(Path).set(
@@ -110,14 +118,12 @@ if _ACTION == "flip":
# modified = "3:00 PM, 04 May 2009",
# accessed = "08/07/2014 18:30:45"
# )
os.chdir(_FULL_PATH)
create_date = filedate.File(filename).get()
if _TEST:
print(_FULL_PATH)
print(myCmd)
print(myCmd)
proc = subprocess.Popen(myCmd,stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
print(f"Fliping {filename} to {export_name} in {_DAY_DIR}...".ljust(100))
print(f"Fliping {filename} in {_DAY_DIR}...".ljust(100))
ff = FfmpegProgress(myCmd)
with tqdm(total=100, position=1, desc="Fliping") as pbar:
for progress in ff.run_command_with_progress():
@@ -129,10 +135,10 @@ if _ACTION == "flip":
#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
try:
shutil.move(export_name, "__" + export_name)
shutil.move(export_name, export_name)
# shutil.move(filename, "__" + export_name)
# shutil.move(export_name, export_name)
filedate.File(_FULL_PATH + export_name).set(
filedate.File(filename).set(
created = create_date["created"],
modified = create_date["modified"],
accessed = create_date["accessed"]
@@ -140,6 +146,12 @@ if _ACTION == "flip":
except ValueError as e:
print(e)
print(f"Failed to move {export_name}")
if _ACTION == "join":
for _DAY_DIR in _DAY_DIRS:
if ops == "win":