簡體   English   中英

無法在 python 的 videoWriter 模塊中使用 opencv 保存視頻

[英]Unable to save the video using opencv in videoWriter module in python

下面是代碼片段。

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

在上面它無法保存視頻。

我想你忘了提供編解碼器的類型。 正確的代碼應該是。

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

編解碼器的類型可以是 mp4、XVID 等。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM