难点
这个问题有几个难点
- opencv保存视频能否播放
- web端能否显示视频
自己研究这个问题研究了整整三天,现在对以上难点进行一一解答
opencv保存视频能否播放
我找到的比较多的例子都是如下这样的
fps = self.video_stream.get(cv2.CAP_PROP_FPS)
size = (int(self.video_stream.get(cv2.CAP_PROP_FRAME_WIDTH)),
int(self.video_stream.get(cv2.CAP_PROP_FRAME_HEIGHT)))
# fourcc = cv2.VideoWriter_fourcc(*'avc1')
# fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v')
# fourcc = cv2.VideoWriter_fourcc(*'MP4V')
# fourcc = cv2.VideoWriter_fourcc(*'FMP4')
fourcc = cv2.VideoWriter_fourcc(*'XVID')
cv_result_file_name = 'test_result.avi'
videoWriter = cv2.VideoWriter(cv_result_file_name,
fourcc, fps,