avconv 合并音频和视频文件
2019-09-17 python 1166
使用avconv 合并音频,视频
avconv -i J:\pygui\gui\diy\svideo\2.avi -i J:\pygui\gui\diy\svideo\2.wav -r 12 J:\pygui\gui\diy\svideo\output.mp4
录制桌面
from PIL import ImageGrab import numpy as np import cv2 from win32api import GetSystemMetrics # screen = ImageGrab.grab() # 获得当前屏幕 num, fps, width, heigh = 0, 12, GetSystemMetrics(0), GetSystemMetrics(1) # 获得分辨率 x = 0 y = 0 x2 = x+width y2 = y+heigh bbox = (x, y, x2, y2) size = (width, heigh) # encode = cv2.VideoWriter_fourcc('M', 'J', 'P', 'G') # avi encode = cv2.VideoWriter_fourcc(*'mp4v') # mp4 video = cv2.VideoWriter("2.mp4", encode, fps, size) while True: im = ImageGrab.grab(bbox=bbox) # 获得当前屏幕 imm = cv2.cvtColor(np.array(im), cv2.COLOR_RGB2BGR) # 转为opencv的BGR格式 cv2.waitKey(0) video.write(imm) if cv2.waitKey(1) & 0xFF == ord('q'): break video.release() cv2.destroyAllWindows()
很赞哦! (0)
相关文章
文章评论
-
-
-
0条评论