![](/img/trans.png)
[英]How to read video from URL in FileVideoStream in imutils?
[英]How to read from video url or from usb camera using videoflow?
它只是被添加到其中。 你可以做這樣的事情。 只要確保在代碼中正確設置了相機的設備ID。
import videoflow
import videoflow.core.flow as flow
from videoflow.core.constants import REALTIME
from videoflow.producers import VideoDeviceReader
from videoflow.consumers import VideofileWriter
class FrameIndexSplitter(videoflow.core.node.ProcessorNode):
def __init__(self):
super(FrameIndexSplitter, self).__init__()
def process(self, data):
index, frame = data
return frame
def main():
output_file = "output.avi"
device_id = 0
reader = VideoDeviceReader(device_id)
frame = FrameIndexSplitter()(reader)
writer = VideofileWriter(output_file, fps = 30)(frame)
fl = flow.Flow([reader], [writer], flow_type = REALTIME)
fl.run()
fl.join()
if __name__ == "__main__":
main()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.