我打开视频文件并将其逐帧复制到另一个文件中:
def copy1(in_file, out_file):
capt = cv.CaptureFromFile(in_file)
frames_num = int(cv.GetCaptureProperty(capt, cv.CV_CAP_PROP_FRAME_COUNT))
fps = int(cv.GetCaptureProperty(capt, cv.CV_CAP_PROP_FPS))
frame_width = int(cv.GetCaptureProperty(capt, cv.CV_CAP_PROP_FRAME_WIDTH))
frame_height = int(cv.GetCaptureProperty(capt, cv.CV_CAP_PROP_FRAME_HEIGHT))
vwriter = cv.CreateVideoWriter(out_file, cv.CV_FOURCC('P', 'I', 'M', '1'), fps, (frame_width, frame_height), True)
for i in range(0, frames_num):
frame = cv.QueryFrame(capt)
if frame:
cv.WriteFrame(vwriter, frame)
else:
pass
print 'Processed', i, 'frames'
然而,当我播放out_file
时,它比原来的更快。
通过将in_file
转换为ogv
切断声音,mpeg1video
创建ffprobe
。 in_file
与out_file
之间6
显示的唯一区别是比特率(out_file
的约{{1}}倍)。
这是什么意思?