#!/usr/bin/env python3
#-*- coding:utf-8-*-
import cv2
import os
im_dir = '/media/dell/72901AB1901A7C33/20191107/_2019-11-07-09-59-36_2/image/'
video_dir = '/media/dell/72901AB1901A7C33/20191107/_2019-11-07-09-59-36_2/fuza.avi'
im_list = os.listdir(im_dir)
im_list=sorted(im_list) #图片顺序
fps = 10
img_size = (1920,1080) #图片分辨率c
fourcc = cv2.VideoWriter_fourcc(*'XVID') #opencv版本3
videoWriter = cv2.VideoWriter(video_dir, fourcc, fps, img_size)
count = 1
for i in im_list:
im_name = os.path.join(im_dir+i)
time = int(i.split('.')[-2])
if time >= 1573092051909911028 and time <= 1573092075010013450:
frame = cv2.imread(im_name)
videoWriter.write(frame)
# count+=1
# if (count == 100):
# break
videoWriter.release()
print ('finish')
根据时间戳,图片转视频
最新推荐文章于 2024-06-19 14:45:58 发布