jhj0517
commited on
Commit
·
d697207
1
Parent(s):
c8c1724
Fix video bug
Browse files
modules/utils/video_helper.py
CHANGED
|
@@ -92,7 +92,6 @@ def get_video_info(vid_input: str) -> VideoInfo:
|
|
| 92 |
"""
|
| 93 |
command = [
|
| 94 |
'ffmpeg',
|
| 95 |
-
'-loglevel', 'error',
|
| 96 |
'-i', vid_input,
|
| 97 |
'-map', '0:v:0',
|
| 98 |
'-c', 'copy',
|
|
@@ -133,6 +132,7 @@ def get_video_info(vid_input: str) -> VideoInfo:
|
|
| 133 |
if frame_rate and duration:
|
| 134 |
num_frames = int(frame_rate * duration)
|
| 135 |
|
|
|
|
| 136 |
return VideoInfo(
|
| 137 |
num_frames=num_frames,
|
| 138 |
frame_rate=frame_rate,
|
|
@@ -227,8 +227,10 @@ def create_video_from_frames(
|
|
| 227 |
]
|
| 228 |
try:
|
| 229 |
subprocess.run(command, check=True)
|
|
|
|
| 230 |
except subprocess.CalledProcessError as e:
|
| 231 |
-
print("Error occurred while creating video from frames")
|
|
|
|
| 232 |
return output_path
|
| 233 |
|
| 234 |
|
|
|
|
| 92 |
"""
|
| 93 |
command = [
|
| 94 |
'ffmpeg',
|
|
|
|
| 95 |
'-i', vid_input,
|
| 96 |
'-map', '0:v:0',
|
| 97 |
'-c', 'copy',
|
|
|
|
| 132 |
if frame_rate and duration:
|
| 133 |
num_frames = int(frame_rate * duration)
|
| 134 |
|
| 135 |
+
print(f"Video info - frame_rate: {frame_rate}, duration: {duration}, total frames: {num_frames}")
|
| 136 |
return VideoInfo(
|
| 137 |
num_frames=num_frames,
|
| 138 |
frame_rate=frame_rate,
|
|
|
|
| 227 |
]
|
| 228 |
try:
|
| 229 |
subprocess.run(command, check=True)
|
| 230 |
+
print(f"Video frames extracted to {frames_dir}")
|
| 231 |
except subprocess.CalledProcessError as e:
|
| 232 |
+
print(f"Error occurred while creating video from frames")
|
| 233 |
+
raise
|
| 234 |
return output_path
|
| 235 |
|
| 236 |
|