Warm tip: This article is reproduced from serverfault.com, please click

raspberry pi-使用ffmpeg录制时从视频中提取帧

(raspberry pi - Extracting frames from video while recording using ffmpeg)

发布于 2020-12-01 10:08:45

我正在使用ffmpeg使用带有其相机模块的Raspberry Pi录制视频。我想在需要从流中提取帧的规则间隔上运行图像分类器。

这是我当前用于记录的命令:

$ ffmpeg -f video4linux2 -input_format h264 -video_size 1280x720 -framerate 30 -i /dev/video0 -vcodec copy -an test.h264

在其他线程中,建议使用此命令

ffmpeg -i file.mpg -r 1/1 $filename%03d.bmp

我认为这不打算与仍附加到文件中的文件一起使用,并且出现错误“无法使用-sseof,test.h264的持续时间未知”。

ffmpeg有什么办法允许它吗?

Questioner
nilolo
Viewed
11
Mark Setchell 2020-12-01 19:34:13

我目前没有配备相机的Raspberry Pi进行测试,但是你应该能够简单地将第二个输出流附加到原始命令中,如下所示,例如获得1帧/秒的BMP图片:

ffmpeg -f video4linux2 -input_format h264 -video_size 1280x720 -framerate 30 -i /dev/video0 -vcodec copy -an test.h264 -r 1 frame-%03d.bmp