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

View File

@@ -82,17 +82,22 @@ 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
for filename in os.listdir(_FULL_PATH):
FPATH = _FULL_PATH + filename
if filename.endswith(".MP4") and not filename.startswith("joined_"):
print(filename)
export_name = 'flipped_' + filename
if ops == "win": if ops == "win":
myCmd = [ myCmd = [
"ffmpeg", "-i", _FILE ,"-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name "ffmpeg", "-i", filename ,"-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name
] ]
else: else:
# myCmd = [ # myCmd = [
# "/usr/bin/ffmpeg", "-f", "-i", _FILE, "-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name # "/usr/bin/ffmpeg", "-f", "-i", _FILE, "-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name
# ] # ]
myCmd = [ myCmd = [
"/usr/bin/ffmpeg", "-f", "-i", _FILE, "-vf", "hflip", "-c:a", "copy", "-y", export_name "/usr/bin/ffmpeg", "-f", "-i", filename, "-vf", "hflip", "-c:a", "copy", "-y", export_name
] ]
#Path = "~/Documents/File.txt" #Path = "~/Documents/File.txt"
@@ -101,13 +106,14 @@ 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)
create_date = filedate.File(filename).get()
if _TEST: if _TEST:
print(_FULL_PATH) print(_FULL_PATH)
print(myCmd) print(myCmd)
os.chdir(_FULL_PATH)
proc = subprocess.Popen(myCmd,stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT) proc = subprocess.Popen(myCmd,stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
print(f"Fliping {_FILE} to {export_name} in {_DAY_DIR}...".ljust(100)) print(f"Fliping {filename} to {export_name} in {_DAY_DIR}...".ljust(100))
ff = FfmpegProgress(myCmd) ff = FfmpegProgress(myCmd)
with tqdm(total=100, position=1, desc="Fliping") as pbar: with tqdm(total=100, position=1, desc="Fliping") as pbar:
for progress in ff.run_command_with_progress(): for progress in ff.run_command_with_progress():
@@ -119,10 +125,10 @@ if _ACTION == "flip":
#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"]