2024-10-01 07:51:31 发布
网友
在Videoflowpython库中有examples关于如何从视频文件中读取视频,但是如何从计算机的usb设备中读取视频呢?你知道吗
只是加进去了。你可以这样做。只需确保在代码中正确设置相机的设备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()
只是加进去了。你可以这样做。只需确保在代码中正确设置相机的设备id。你知道吗
相关问题 更多 >
编程相关推荐