Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何制作长的视频 #30

Open
xuanxuanzl opened this issue Nov 24, 2024 · 2 comments
Open

如何制作长的视频 #30

xuanxuanzl opened this issue Nov 24, 2024 · 2 comments
Labels

Comments

@xuanxuanzl
Copy link

视频长度设置为2400,不起作用,只录了14S。
语音长度有两分钟。

@tristan88888
Copy link

tristan88888 commented Nov 25, 2024

If you take a look at infer.py, this line limits the video duration:

args.L = min(args.L, int(audio_clip.duration * final_fps), len(os.listdir(inputs_dict['pose'])))

There are 336 pose files, which corresponds to 14s of video (336 / fps) if fps = 24

Two resolution methods:

  1. manually replicate the pose files and renumber the additional copies as needed

  2. modify the above line of code and the following loop so that it uses a modulus 336 for the pose index

    for index in range(start_idx, start_idx + args.L):
    tgt_musk = np.zeros((args.W, args.H, 3)).astype('uint8')
    tgt_musk_path = os.path.join(inputs_dict['pose'], "{}.npy".format(index))
    detected_pose = np.load(tgt_musk_path, allow_pickle=True).tolist()
    imh_new, imw_new, rb, re, cb, ce = detected_pose['draw_pose_params']
    im = draw_pose_select_v2(detected_pose, imh_new, imw_new, ref_w=800)
    im = np.transpose(np.array(im),(1, 2, 0))
    tgt_musk[rb:re,cb:ce,:] = im

     tgt_musk_pil = Image.fromarray(np.array(tgt_musk)).convert('RGB')
     pose_list.append(torch.Tensor(np.array(tgt_musk_pil)).to(dtype=weight_dtype, device=device).permute(2,0,1) / 255.0)
    

Maybe like this:

num_pose_files = len(os.listdir(inputs_dict['pose']) # Total number of pose files (indices 0 to 335)

for index in range(start_idx, start_idx + args.L):
tgt_musk = np.zeros((args.W, args.H, 3)).astype('uint8')

# Use modulus to wrap around the frame index
file_index = index % num_pose_files

tgt_musk_path = os.path.join(inputs_dict['pose'], "{}.npy".format(file_index))
detected_pose = np.load(tgt_musk_path, allow_pickle=True).tolist()
imh_new, imw_new, rb, re, cb, ce = detected_pose['draw_pose_params']
im = draw_pose_select_v2(detected_pose, imh_new, imw_new, ref_w=800)
im = np.transpose(np.array(im), (1, 2, 0))
tgt_musk[rb:re, cb:ce, :] = im

tgt_musk_pil = Image.fromarray(np.array(tgt_musk)).convert('RGB')
pose_list.append(torch.Tensor(np.array(tgt_musk_pil)).to(dtype=weight_dtype, device=device).permute(2, 0, 1) / 255.0)

@mengrang
Copy link
Collaborator

assets中的pose文件有限,稍后我更新一个外围脚本制作自定义pose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants