Is it possible to retrieve frames as images out of

2019-08-16 00:20发布

问题:

Has anyone tried this ?

What's the best practice for this?

回答1:

FMS live streams are using the RTMP protocol:

ffmpeg -i rtmp://***server/path* **-acodec copy -vcodec copy -y *captured***.flv**

Here, we are saving the whole stream to an FLV file, which is Flash's static movie file format and so can always preserve all RTMP audio and video codecs without conversion.

You can then extract any frames you want, e.g.

ffmpeg -i *captured***.flv -s** starttime -vframes 1 -f image2 -vcodec mjpeg *captured***.jpg**

If you are ambitious and know exactly what time offsets and intervals you want to capture in advance, you can do both steps at once, e.g. one frame every second:

ffmpeg -i rtmp://***server/path* **-r 1 -f image2 -vcodec mjpeg *captured***%d.jpg**

All commandlines have not been tested, will need fixing but give you a good impression