(资源与代码同目录下即可不报错)
# import cv2
# import numpy
# import shutil
# import os
# import time
# from multiprocessing import Process
# class MyProcess(Process):
# def __init__(self,path,x,y):
# self.path=path
# self.x = x
# self.y = y
# super().__init__()
# def run(self):
# cap = cv2.VideoCapture(self.path)
# while True:
# ret, frame = cap.read()
# print(ret, frame)
# cv2.namedWindow("frame", 0)
# cv2.moveWindow("frame",self.x,self.y)
# cv2.resizeWindow("frame", 720, 405)
# cv2.imshow('frame', frame)
# if cv2.waitKey(1) and 0xFF == ord('q'):
# break
# cap.release()
# if __name__ == '__main__':
# for i in os.listdir(r'H:1-2铅笔视频1.1cp'):
# p=os.path.join(r'H:1-2铅笔视频1.1cp',i)
# # print(p)
# p1=p.replace('cp','fp')
# # print(p1)
# shutil.copy2(p,r'C:UserslenovoDesktop1.mp4')
# shutil.copy2(p1,r'C:UserslenovoDesktop2.mp4')
# time.sleep(1)
# t = MyProcess(r'C:UserslenovoDesktop1.mp4',0,0)
# t1 =MyProcess(r'C:UserslenovoDesktop2.mp4',0,500)
# t.start()
# t1.start()
# t.join()
# t1.join()
# os.remove(r'C:UserslenovoDesktop1.mp4')
# os.remove(r'C:UserslenovoDesktop2.mp4')
# time.sleep(5)
# import cv2
# import numpy
# import shutil
# import os
# import time
# from threading import Thread
# def func(path,x,y,name):
# cap = cv2.VideoCapture(path)
# while True:
# ret, frame = cap.read()
# # print(ret, frame)
# cv2.namedWindow(name, 0)
# cv2.moveWindow(name,x,y)
# cv2.resizeWindow(name, 720, 405)
# cv2.imshow(name, frame)
# if cv2.waitKey(1) and 0xFF == ord('q'):
# break
# cap.release()
# # p=input('输入路径')
# for i in os.listdir(r'H:1-2铅笔视频1.1cp'):
# p=os.path.join(r'H:1-2铅笔视频1.1cp',i)
# # print(p)
# p1=p.replace('cp','fp')
# # print(p1)
# shutil.copy2(p,r'C:UserslenovoDesktop1.mp4')
# shutil.copy2(p1,r'C:UserslenovoDesktop2.mp4')
# time.sleep(1)
# t = Thread(target=func,args=(r'C:UserslenovoDesktop1.mp4',0,0,'frame'))
# t1 = Thread(target=func,args=(r'C:UserslenovoDesktop2.mp4',0,500,'frame1'))
# t.start()
# t1.start()
# t.join()
# t1.join()
# os.remove(r'C:UserslenovoDesktop1.mp4')
# os.remove(r'C:UserslenovoDesktop2.mp4')
# time.sleep(5)
# import cv2
# import numpy
# import shutil
# import os
# import time
# from threading import Thread
# class MyThread(Thread):
# def __init__(self,path,x,y,names):
# self.path=path
# self.x = x
# self.y = y
# self.names = names
# super().__init__()
# def run(self):
# cap = cv2.VideoCapture(self.path)
# while True:
# ret, frame = cap.read()
# # print(ret, frame)
# cv2.namedWindow(self.name, 0)
# cv2.moveWindow(self.name,self.x,self.y)
# cv2.resizeWindow(self.name, 720, 405)
# cv2.imshow(self.name, frame)
# if cv2.waitKey(1) and 0xFF == ord('q'):
# break
# cap.release()
# for i in os.listdir(r'H:1-2铅笔视频1.1cp'):
# p=os.path.join(r'H:1-2铅笔视频1.1cp',i)
# # print(p)
# p1=p.replace('cp','fp')
# # print(p1)
# shutil.copy2(p,r'C:UserslenovoDesktop1.mp4')
# shutil.copy2(p1,r'C:UserslenovoDesktop2.mp4')
# time.sleep(1)
# t = MyThread(r'C:UserslenovoDesktop1.mp4',0,0,'frame')
# t1 =MyThread(r'C:UserslenovoDesktop2.mp4',0,500,'frame1')
# t.start()
# t1.start()
# t.join()
# t1.join()
# os.remove(r'C:UserslenovoDesktop1.mp4')
# os.remove(r'C:UserslenovoDesktop2.mp4')
# time.sleep(5)