taskManager / task /_3检测output_video效果.py
rogerxavier's picture
Update task/_3检测output_video效果.py
d5d29d1 verified
raw
history blame
892 Bytes
import requests
#->void
def download_output_video(baseUrl:str,save_path:str,fake_headers:dict=None):
# 创建一个Session对象
session = requests.Session()
if fake_headers is not None:
session.headers = fake_headers
url = baseUrl+"/get_video" # 请替换为您的实际服务器地址和端口
params = {
"dir": "/mp4_out/output_video.mp4" # 指定要获取的视频文件路径
}
response = session.get(url, params=params)
if response.status_code == 200:
with open(save_path, "wb") as file:
file.write(response.content)
print("视频文件已保存为 output_video.mp4")
else:
print("Error: Failed to get video. Status code:", response.status_code)
if __name__ == '__main__':
download_output_video(baseUrl="https://rogerxavier-moviepy-with-manga-test.hf.space",save_path="output_video.mp4")