我打开视频文件并将其逐帧复制到另一个文件,如下所示:
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
创建形式。显示和之间的唯一区别是比特率(大约高出 1倍)。这意味着什么?ogv
mpeg1video
ffprobe
in_file
out_file
6
out_file