feat(新功能):
fix(修复bug): pose transform 模块 upload video 保存地址修改 docs(文档变更): refactor(重构): test(增加测试):
This commit is contained in:
@@ -49,24 +49,24 @@ def upload_gif(gif_buffer, user_id, category, file_name):
|
||||
|
||||
def upload_video(frames, user_id, category, file_name):
|
||||
try:
|
||||
ndarray_to_video(frames, file_name)
|
||||
save_path = ndarray_to_video(frames, file_name)
|
||||
object_name = f'{user_id}/{category}/{file_name}'
|
||||
minio_client.fput_object(
|
||||
"aida-users",
|
||||
object_name,
|
||||
file_name,
|
||||
save_path,
|
||||
content_type="video/mp4" # 指定MIME类型确保可在线播放[9](@ref)
|
||||
)
|
||||
print(file_name)
|
||||
return f"aida-users/{object_name}"
|
||||
except Exception as e:
|
||||
logging.warning(f"upload_video runtime exception : {e}")
|
||||
|
||||
|
||||
def ndarray_to_video(images, output_path, frame_size=(512, 768), fps=9):
|
||||
save_path = os.path.join(POSE_TRANSFORM_VIDEO_PATH, output_path)
|
||||
# 初始化视频写入器
|
||||
writer = skvideo.io.FFmpegWriter(
|
||||
os.path.join(POSE_TRANSFORM_VIDEO_PATH,output_path),
|
||||
save_path,
|
||||
inputdict={'-r': str(fps)},
|
||||
outputdict={'-r': str(fps), '-vcodec': 'libx264'}
|
||||
)
|
||||
@@ -80,6 +80,7 @@ def ndarray_to_video(images, output_path, frame_size=(512, 768), fps=9):
|
||||
|
||||
# 关闭写入器
|
||||
writer.close()
|
||||
return save_path
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user