图片合称为视频

import cv2

import os

def pic_video(args_input_path,folder_path,output_video_path):

count = 1

image_files = [os.path.join(folder_path, file) for file in os.listdir(folder_path) if file.endswith('.png')]

img = cv2.imread(image_files[0])

height = img.shape[0]

width = img.shape[1]

videoCapture = cv2.VideoCapture(args_input_path)

fps = videoCapture.get(cv2.CAP_PROP_FPS)

fourcc = cv2.VideoWriter_fourcc(*'mp4v') # 可根据需要更改视频编码器

video = cv2.VideoWriter(output_video_path, fourcc, fps, (width, height))

for image_file in image_files:

if count%100 == 0:

print(count)

img = cv2.imread(image_file)

video.write(img)

count+=1

video.release()

pic_video('/home/sunyingli/Real-ESRGAN/tools/聪明的一休_720_1280.mp4','/home/sunyingli/Real-ESRGAN/inputs/1yixiu_720_1280_cf','/home/sunyingli/Real-ESRGAN/inputs/1yixiu_720_1280_cf.mp4')

相关推荐
如若12333 分钟前
WSL2 启动报错“拒绝访问“ E_ACCESSDENIED 完整解决方案
人工智能·pytorch·python·深度学习·计算机视觉
却道天凉_好个秋36 分钟前
音视频学习(九十八):Profile
学习·音视频·profile
我就想睡到自然醒1 小时前
【论文翻译】CA注意力机制原文翻译 Coordinate Attention for Efficient Mobile Network Design
图像处理·人工智能·计算机视觉·目标跟踪·图像分类
:mnong1 小时前
FramePack视频帧预测设计分析
音视频
:mnong2 小时前
MOVA MOSS Video and Audio同步视频-音频设计分析
音视频
chushiyunen2 小时前
python cosyVoice实现tts文本转语音、音频(未完成)
开发语言·python·音视频
AI科技星11 小时前
全尺度角速度统一:基于 v ≡ c 的纯推导与验证
c语言·开发语言·人工智能·opencv·算法·机器学习·数据挖掘
Westward-sun.14 小时前
CNN 核心知识点详解:从图像基础到卷积与池化
人工智能·计算机视觉·cnn
jay神15 小时前
基于YOLOv8的钢材表面缺陷检测系统
人工智能·算法·yolo·目标检测·计算机视觉
愚公搬代码16 小时前
【愚公系列】《剪映+DeepSeek+即梦:短视频制作》018-特效:轻松提升视频质感(知识拓展:轴线原则)
人工智能·音视频