Update tools/video_encode_tool.py
Browse files
tools/video_encode_tool.py
CHANGED
|
@@ -126,7 +126,7 @@ class VideoEncodeTool:
|
|
| 126 |
|
| 127 |
if len(video_paths) == 1:
|
| 128 |
shutil.copy(video_paths[0], output_path)
|
| 129 |
-
|
| 130 |
return output_path
|
| 131 |
|
| 132 |
temp_dir = os.path.join(workspace_dir, "temp_trimmed_videos")
|
|
@@ -145,7 +145,7 @@ class VideoEncodeTool:
|
|
| 145 |
]
|
| 146 |
result = subprocess.run(probe_cmd, capture_output=True, text=True, check=True)
|
| 147 |
total_frames = int(result.stdout.strip())
|
| 148 |
-
|
| 149 |
|
| 150 |
# Define limites de corte
|
| 151 |
start_frame = start
|
|
@@ -159,10 +159,10 @@ class VideoEncodeTool:
|
|
| 159 |
f'-vf "trim=start_frame={start_frame}:end_frame={end_frame},setpts=PTS-STARTPTS" '
|
| 160 |
f'-an "{video_podado}"'
|
| 161 |
)
|
| 162 |
-
|
| 163 |
subprocess.run(cmd_fim, shell=True, check=True)
|
| 164 |
processed_videos.append(video_podado)
|
| 165 |
-
|
| 166 |
else:
|
| 167 |
processed_videos.append(abs_base)
|
| 168 |
|
|
@@ -177,7 +177,7 @@ class VideoEncodeTool:
|
|
| 177 |
f'ffmpeg -y -hide_banner -loglevel error -f concat -safe 0 '
|
| 178 |
f'-i "{list_file_path}" -c copy "{output_path}"'
|
| 179 |
)
|
| 180 |
-
|
| 181 |
subprocess.run(cmd_concat, shell=True, check=True)
|
| 182 |
logger.info("[ConcatOK] Concatenação concluída com sucesso.")
|
| 183 |
return output_path
|
|
|
|
| 126 |
|
| 127 |
if len(video_paths) == 1:
|
| 128 |
shutil.copy(video_paths[0], output_path)
|
| 129 |
+
print(f"[Concat] Apenas um clipe fornecido. Copiado para '{output_path}'.")
|
| 130 |
return output_path
|
| 131 |
|
| 132 |
temp_dir = os.path.join(workspace_dir, "temp_trimmed_videos")
|
|
|
|
| 145 |
]
|
| 146 |
result = subprocess.run(probe_cmd, capture_output=True, text=True, check=True)
|
| 147 |
total_frames = int(result.stdout.strip())
|
| 148 |
+
print(f"[Trim] {os.path.basename(base)} → total_frames={total_frames}")
|
| 149 |
|
| 150 |
# Define limites de corte
|
| 151 |
start_frame = start
|
|
|
|
| 159 |
f'-vf "trim=start_frame={start_frame}:end_frame={end_frame},setpts=PTS-STARTPTS" '
|
| 160 |
f'-an "{video_podado}"'
|
| 161 |
)
|
| 162 |
+
print(f"[CmdTrim] {cmd_fim}")
|
| 163 |
subprocess.run(cmd_fim, shell=True, check=True)
|
| 164 |
processed_videos.append(video_podado)
|
| 165 |
+
print(f"[TrimOK] {os.path.basename(base)} → -1 frame ({end_frame}/{total_frames})")
|
| 166 |
else:
|
| 167 |
processed_videos.append(abs_base)
|
| 168 |
|
|
|
|
| 177 |
f'ffmpeg -y -hide_banner -loglevel error -f concat -safe 0 '
|
| 178 |
f'-i "{list_file_path}" -c copy "{output_path}"'
|
| 179 |
)
|
| 180 |
+
print(f"[Concat] Executando concatenação final: {cmd_concat}")
|
| 181 |
subprocess.run(cmd_concat, shell=True, check=True)
|
| 182 |
logger.info("[ConcatOK] Concatenação concluída com sucesso.")
|
| 183 |
return output_path
|