Text2Video-Zero / __assets__ /fr_converter.py
lev1's picture
Assets
6a0dd6d
raw
history blame
693 Bytes
import os
from glob import glob
from pathlib import Path
new_fr = 2
dir_path = "poses_skeleton_gifs"
new_dir_path = "poses_skeleton_gifs_2fps"
Path(new_dir_path).mkdir(parents=True, exist_ok=True)
for full_filename in glob(dir_path+"/*.mp4"):
filename = full_filename.split("/")[-1].split(".")[0]
new_full_filename_h264 = new_dir_path + "/" + filename + ".h264"
new_full_filename_mp4 = new_dir_path + "/" + filename + ".mp4"
os.system("ffmpeg -y -i {0} -c copy -f h264 {1}".format(full_filename, new_full_filename_h264))
os.system("ffmpeg -y -r {0} -i {1} -c copy {2}".format(new_fr, new_full_filename_h264, new_full_filename_mp4))
os.remove(new_full_filename_h264)