问题描述
我们正在处理RTMP上的流式视频,我的目标是以给定的时间间隔从流中提取帧。每1秒。
We're dealing with streaming video on RTMP and my goal is to extract frames from the stream at a given interval, e.g. every 1 second.
目前我在一个循环中运行一个命令,它需要一个框架并将其作为base64 JPEG导出:
Currently I run a command in a loop, which takes a frame and exports it as base64 JPEG:
avconv -i <URL> -y -f image2 -ss 3 -vcodec mjpeg -vframes 1 -s sqcif /dev/stdout 2>/dev/null | base64 -w 0
但是,这些过程都很长(需要几秒钟 - 甚至增加了更多延迟流媒体视频已经不是实时的)。我想知道是否有办法使avconv或ffmpeg以间隔(以秒或帧)提取帧,并将其另存为文件或转储到stdout。
But each of these processes is long (takes a few seconds -- which adds even more delay on streaming video that's not real time already). I am wondering if there is a way to make avconv or ffmpeg to extract frames at an interval (in seconds or frames) and either save as a file or dump to stdout.
我真的很感谢你的帮助!
I would really appreciate your help!
推荐答案
你尝试过吗?
ffmpeg -i <URL> -r 1 out%03d.jpg
这篇关于如何使用avconv / ffmpeg从流式RTMP连续提取视频帧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!