This commit is contained in:
2025-06-16 07:50:04 +02:00
parent 646e2eeb7d
commit 51a5d97916

View File

@@ -82,18 +82,23 @@ if _ACTION == "flip":
_FULL_PATH = _SOURCE_DIR + "\\" + _DEV + "\\" + _DAY_DIR + "\\" _FULL_PATH = _SOURCE_DIR + "\\" + _DEV + "\\" + _DAY_DIR + "\\"
else: else:
_FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR + "/" _FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR + "/"
export_name = "X" + _FILE
if ops == "win": for filename in os.listdir(_FULL_PATH):
myCmd = [ FPATH = _FULL_PATH + filename
"ffmpeg", "-i", _FILE ,"-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name if filename.endswith(".MP4") and not filename.startswith("joined_"):
] print(filename)
else: export_name = 'flipped_' + filename
# myCmd = [ if ops == "win":
# "/usr/bin/ffmpeg", "-f", "-i", _FILE, "-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name myCmd = [
# ] "ffmpeg", "-i", filename ,"-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name
myCmd = [ ]
"/usr/bin/ffmpeg", "-f", "-i", _FILE, "-vf", "hflip", "-c:a", "copy", "-y", export_name else:
] # myCmd = [
# "/usr/bin/ffmpeg", "-f", "-i", _FILE, "-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name
# ]
myCmd = [
"/usr/bin/ffmpeg", "-f", "-i", filename, "-vf", "hflip", "-c:a", "copy", "-y", export_name
]
#Path = "~/Documents/File.txt" #Path = "~/Documents/File.txt"
# filedate.File(Path).set( # filedate.File(Path).set(
@@ -101,28 +106,29 @@ if _ACTION == "flip":
# modified = "3:00 PM, 04 May 2009", # modified = "3:00 PM, 04 May 2009",
# accessed = "08/07/2014 18:30:45" # accessed = "08/07/2014 18:30:45"
# ) # )
create_date = filedate.File(_FULL_PATH + _FILE).get() os.chdir(_FULL_PATH)
if _TEST: create_date = filedate.File(filename).get()
print(_FULL_PATH) if _TEST:
print(myCmd) print(_FULL_PATH)
os.chdir(_FULL_PATH) print(myCmd)
proc = subprocess.Popen(myCmd,stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
print(f"Fliping {_FILE} to {export_name} in {_DAY_DIR}...".ljust(100)) proc = subprocess.Popen(myCmd,stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
ff = FfmpegProgress(myCmd) print(f"Fliping {filename} to {export_name} in {_DAY_DIR}...".ljust(100))
with tqdm(total=100, position=1, desc="Fliping") as pbar: ff = FfmpegProgress(myCmd)
for progress in ff.run_command_with_progress(): with tqdm(total=100, position=1, desc="Fliping") as pbar:
pbar.update(progress - pbar.n) for progress in ff.run_command_with_progress():
pbar.close() pbar.update(progress - pbar.n)
pbar.close()
print(f"Done".ljust(130),end='', flush=True) print(f"Done".ljust(130),end='', flush=True)
# get the output # get the output
#print(ff.stderr) #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 #ffmpeg -i .\GH010149.MP4 -c:v hevc_amf -rc cqp -qp_i 42 -qp_p 42 -quality quality -crf 25 output7.mp4
try: try:
shutil.move(_FILE, "__" + export_name) shutil.move(export_name, "__" + export_name)
shutil.move(export_name, _FILE) shutil.move(export_name, export_name)
filedate.File(_FULL_PATH + _FILE).set( filedate.File(_FULL_PATH + export_name).set(
created = create_date["created"], created = create_date["created"],
modified = create_date["modified"], modified = create_date["modified"],
accessed = create_date["accessed"] accessed = create_date["accessed"]