-
Notifications
You must be signed in to change notification settings - Fork 390
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
How can I fix the FPS at 10? #77
Comments
I rewrote the code for generating videos, which might be helpful for you. import cv2
import os
import glob
from tqdm import tqdm
# images route
root_path = os.path.abspath("./results_img")
# output vedio route
video_save_path = os.path.abspath("./frame2vedio")
def generateVedio(name_list):
global video_save_path
for i in tqdm(range(len(name_list))):
person_name = name_list[i]
frame_path = root_path + "/" + person_name
image_files = glob.glob(frame_path + "/*.jpg")
image_files.sort(key=lambda x: int(os.path.splitext(os.path.basename(x))[0].split("_")[-1]))
size = (2304, 1440)
fourcc = cv2.VideoWriter_fourcc(*"mp4v")
# 20 is the FPS, you can change it
videowrite = cv2.VideoWriter(video_save_path + "/" + person_name + ".mp4", fourcc, 20, size)
img_array = []
for filename in image_files:
img = cv2.imread(filename)
img_array.append(img)
for j in range(len(image_files)):
videowrite.write(img_array[j])
print("视频{0}.mp4生成完毕!".format(person_name))
if __name__ == "__main__":
name_list = os.listdir(root_path)
print(name_list)
generateVedio(name_list) Add something like this in demo_camera.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First of all, thank you for creating this code.
I am currently working on a video and the FPS value is not stable. Therefore, I would like to fix the FPS at 10.
I would like to know what position and what kind of code I should write.
The text was updated successfully, but these errors were encountered: