update write_video with ffmpeg
This commit is contained in:
1 parent
4d4015350c
commit
0d5689979f
8 files changed
+186
-173
No files matched your search
@@ -241,7 +241,7 @@ class Audio2MeshModel(Base):
|
||||
print(f"save infer_result shape = {batch_pdt_geo.shape} -> {path_save_npy}")
|
||||
|
||||
|
||||
def infer(self, batch_cond, raw_speech, suffix="", save_npy=True):
|
||||
def infer(self, batch_cond, batch_speech, suffix="", save_npy=True):
|
||||
self.eval()
|
||||
self.cond = batch_cond.float().to(self.device) # (nsteps, dim_cond)
|
||||
|
||||
@@ -255,7 +255,7 @@ class Audio2MeshModel(Base):
|
||||
batch_pdt_geo = batch_pdt_geo - self.temp_verts + self.temp_verts_specific
|
||||
|
||||
# render & and save
|
||||
self.save_reconstruct(batch_pdt_geo, raw_speech, path_save=Path(self.opt.OUTPUT_DIR),
|
||||
self.save_reconstruct(batch_pdt_geo, batch_speech, path_save=Path(self.opt.OUTPUT_DIR),
|
||||
suffix=suffix, vis_landmarks=False)
|
||||
|
||||
if save_npy:
|
||||
@@ -402,7 +402,7 @@ class Audio2MeshModel(Base):
|
||||
|
||||
return loss, loss_dict
|
||||
|
||||
def save_reconstruct(self, batch_pdt_geo, raw_speech, path_save, suffix="", vis_landmarks=False):
|
||||
def save_reconstruct(self, batch_pdt_geo, batch_speech, path_save, suffix="", vis_landmarks=False):
|
||||
# batch_pdt_geo, [B x N x dim_motion]
|
||||
|
||||
B, N, *_ = batch_pdt_geo.shape
|
||||
@@ -441,7 +441,7 @@ class Audio2MeshModel(Base):
|
||||
|
||||
# write video
|
||||
ipath_save = path_save.joinpath(f"{suffix}_{i:02d}_pt.mp4")
|
||||
write_video(v_render_pt, raw_speech, ipath_save, fps=50)
|
||||
write_video(v_render_pt, batch_speech, ipath_save, fps=50)
|
||||
self.logger.info(f"save video to -> {str(ipath_save)}")
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ class Audio2MeshModel(Base):
|
||||
return images
|
||||
|
||||
@torch.no_grad()
|
||||
def save_reconstruct_with_gt2(self, batch_pdt_geo, batch_tgt_geo, raw_speech, path_save, suffix="", vis_landmarks=True):
|
||||
def save_reconstruct_with_gt2(self, batch_pdt_geo, batch_tgt_geo, batch_speech, path_save, suffix="", vis_landmarks=True):
|
||||
# batch_pdt_geo, [1 x N x 5023 x 3]
|
||||
# batch_tgt_geo, [1 x N x 5023 x 3]
|
||||
|
||||
@@ -518,7 +518,7 @@ class Audio2MeshModel(Base):
|
||||
|
||||
|
||||
# save animation
|
||||
write_video_with_gt(v_render_pt, v_render_gt, raw_speech, ipath_save, fps=50, sr=16000)
|
||||
write_video_with_gt(v_render_pt, v_render_gt, batch_speech, ipath_save, fps=50, sr=16000)
|
||||
# print(f"testing v_render_pt = {len(v_render_pt)}, gt shape = {len(v_render_gt)}")
|
||||
|
||||
|
||||
@@ -587,8 +587,7 @@ class Audio2MeshModel(Base):
|
||||
jstart_time = (jstart_frame + 7) / self.opt.DATASET.fps # xxx.yyy min
|
||||
jend_time = (jstart_frame + 7 + self.nseq) / self.opt.DATASET.fps # xxx.yyy min
|
||||
# print(f"jvid={jvid}, jnfram={jnframe}, jstart_frame={jstart_frame}, jpath_audio={jpath_audio}")
|
||||
# print(f"jstart_time={jstart_time}, jend_time={jend_time}")
|
||||
|
||||
# print(f"jstart_time={jstart_time}, jend_time={jend_time}")
|
||||
|
||||
# save animation
|
||||
# print(f"testing v_render_pt = {len(v_render_pt)}, gt shape = {len(v_render_gt)}")
|
||||
|
||||
Reference in new issue
Block a user