这是程序(它记录并流式传输正在记录的内容)(但不保存):
import cv2
import numpy as np
import os
FILE_OUTPUT = 'output.avi'
if os.path.isfile(FILE_OUTPUT):
os.remove(FILE_OUTPUT)
cap = cv2.VideoCapture(0)
currentFrame = 0
width = cap.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)
height = cap.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)
fourcc = cv2.cv.CV_FOURCC(*'X264')
out = cv2.VideoWriter(FILE_OUTPUT,fourcc, 20.0, (int(width),int(height)))
while(cap.isOpened()):
ret, frame = cap.read()
if ret == True:
frame = cv2.flip(frame,1)
out.write(frame)
cv2.imshow('Video',frame)
else:
break
if cv2.waitKey(1) & 0xFF == ord('q'):
break
currentFrame += 1
cap.release()
out.release()
cv2.destroyAllWindows()
错误在这里:
[libx264 @ 0xb5d0b0] broken ffmpeg default settings detected
[libx264 @ 0xb5d0b0] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0xb5d0b0] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0xb5d0b0] speed presets are listed in x264 --help
[libx264 @ 0xb5d0b0] profile is optional; x264 defaults to high
有人可以解决这个错误吗?还是以其他方式帮助我? 我一直在寻找解决方案,但我找不到真正的解决方案。 保存部分无法正常工作