fps param added to vid output
Browse files- FGT_codes/tool/video_inpainting.py +1 -1
- app.py +5 -0
FGT_codes/tool/video_inpainting.py
CHANGED
@@ -776,7 +776,7 @@ def video_inpainting(args, imgArr, imgMaskArr):
|
|
776 |
for i in range(len(comp_frames)):
|
777 |
comp_frames[i] = comp_frames[i].astype(np.uint8)
|
778 |
imageio.mimwrite(
|
779 |
-
os.path.join(args.outroot, "result.mp4"), comp_frames, fps=
|
780 |
)
|
781 |
print(f"Done, please check your result in {args.outroot} ")
|
782 |
|
|
|
776 |
for i in range(len(comp_frames)):
|
777 |
comp_frames[i] = comp_frames[i].astype(np.uint8)
|
778 |
imageio.mimwrite(
|
779 |
+
os.path.join(args.outroot, "result.mp4"), comp_frames, fps=args.out_fps, quality=8
|
780 |
)
|
781 |
print(f"Done, please check your result in {args.outroot} ")
|
782 |
|
app.py
CHANGED
@@ -51,6 +51,7 @@ object_x = 0
|
|
51 |
object_y = 0
|
52 |
object_width = 0
|
53 |
object_height = 0
|
|
|
54 |
original_frame_list = []
|
55 |
mask_list = []
|
56 |
|
@@ -113,6 +114,8 @@ parser.add_argument('--step', type=int, default=10)
|
|
113 |
parser.add_argument('--num_ref', type=int, default=-1)
|
114 |
parser.add_argument('--neighbor_stride', type=int, default=5)
|
115 |
|
|
|
|
|
116 |
# visualization
|
117 |
parser.add_argument('--vis_flows', action='store_true',
|
118 |
help='Visualize the initialized flows')
|
@@ -150,6 +153,7 @@ def track_and_mask(vid, original_frame, masked_frame):
|
|
150 |
video_capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
151 |
fps = video_capture.get(cv2.CAP_PROP_FPS)
|
152 |
|
|
|
153 |
# can't write out mp4, so try to write into an AVI file
|
154 |
video_writer = cv2.VideoWriter(
|
155 |
"output.avi", cv2.VideoWriter_fourcc(*'MP42'), fps, (width, height))
|
@@ -203,6 +207,7 @@ def track_and_mask(vid, original_frame, masked_frame):
|
|
203 |
|
204 |
|
205 |
def inpaint_video():
|
|
|
206 |
video_inpainting(args, original_frame_list, mask_list)
|
207 |
|
208 |
return "result.mp4"
|
|
|
51 |
object_y = 0
|
52 |
object_width = 0
|
53 |
object_height = 0
|
54 |
+
in_fps = 24
|
55 |
original_frame_list = []
|
56 |
mask_list = []
|
57 |
|
|
|
114 |
parser.add_argument('--num_ref', type=int, default=-1)
|
115 |
parser.add_argument('--neighbor_stride', type=int, default=5)
|
116 |
|
117 |
+
parser.add_argument('--out_fps', type=int, default=24)
|
118 |
+
|
119 |
# visualization
|
120 |
parser.add_argument('--vis_flows', action='store_true',
|
121 |
help='Visualize the initialized flows')
|
|
|
153 |
video_capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
154 |
fps = video_capture.get(cv2.CAP_PROP_FPS)
|
155 |
|
156 |
+
in_fps = fps
|
157 |
# can't write out mp4, so try to write into an AVI file
|
158 |
video_writer = cv2.VideoWriter(
|
159 |
"output.avi", cv2.VideoWriter_fourcc(*'MP42'), fps, (width, height))
|
|
|
207 |
|
208 |
|
209 |
def inpaint_video():
|
210 |
+
args.out_fps = in_fps
|
211 |
video_inpainting(args, original_frame_list, mask_list)
|
212 |
|
213 |
return "result.mp4"
|