【问题标题】:Unable to save the video using opencv in videoWriter module in python无法在 python 的 videoWriter 模块中使用 opencv 保存视频
【发布时间】:2020-08-21 09:08:24
【问题描述】:

下面是代码sn-p。

fourcc = cv2.VideoWriter_fourcc(*)
out = cv2.VideoWriter('/Users\Dell\Documents\GitHub\capstoneproject\ProjectS\sample\example_03.mp4',fourcc, 20.0, (640,480))

while(cap.isOpened()):
    ret, frame = cap.read()


        # write the flipped frame
    out.write(frame)

    cv2.imshow('frame',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

在上面它无法保存视频。

【问题讨论】:

  • 你能详细说明一下吗?您没有提供足够的详细信息,无法让任何人回答您的问题。

标签: python opencv image-processing video video-capture


【解决方案1】:

我想你忘了提供编解码器的类型。正确的代码应该是。

fourcc = cv2.VideoWriter_fourcc(*'type of codec')

编解码器类型可以是mp4、XVID等

【讨论】:

    猜你喜欢
    • 2021-01-02
    • 1970-01-01
    • 2020-04-01
    • 2023-01-04
    • 2019-07-11
    • 1970-01-01
    • 2018-12-05
    • 2018-03-04
    • 1970-01-01
    相关资源
    最近更新 更多