我试图处理一个实时的hlsv流,从中提取每100帧,并使用openCV进行处理
目前,我的代码如下所示:
pipe = subprocess.Popen([FFMPEG_BIN, "-i", src,
"-loglevel", "quiet",
"-an",
"-f", "image2pipe",
"-pix_fmt", "bgr24",
"-vcodec", "rawvideo", "-"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL)
while True:
raw_image = pipe.stdout.read(WIDTH * HEIGHT * 3)
if frame_counter > 100:
frame_counter = 0
process_frame(raw_image)
frame_counter += 1
读取所有帧并转储99%的帧似乎效率低下,并导致了管道缓冲区问题(至少我怀疑是这样)
是否可以跳过FFMPEG中的帧,以便每100帧都将转到标准输出
使用“选择”过滤器保留每100帧一次
相关问题 更多 >
编程相关推荐