使用 ffmpeg 捕获 Windows 屏幕 [英] Capture Windows screen with ffmpeg

查看:17
本文介绍了使用 ffmpeg 捕获 Windows 屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ffmpeg 是一种跨平台且非常强大的软件,用于处理视频/音频或流式传输.在 Linux 上,ffmpeg 可以使用以下命令捕获 X11 屏幕:

The ffmpeg is cross-platform and very powerful software to handle video/audio or to stream it. On Linux ffmpeg can capture X11 screen with a command below:

ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpeg

但是可以用 ffmpeg 抓取 Windows 桌面吗?

But is it possible to grab Windows Desktop with ffmpeg?

推荐答案

使用 内置 GDI 屏幕抓取器(无需安装)像这样:

Use the built-in GDI screengrabber (no install needed) like this :

ffmpeg -f gdigrab -framerate 10 -i desktop [output]

这会将您的所有显示器捕获为一个大的连续显示器.

This will capture ALL your displays as one big contiguous display.

如果你想限制到一个区域,并显示被抓取的区域:

If you want to limit to a region, and show the area being grabbed:

ffmpeg -f gdigrab -framerate ntsc -offset_x 10 -offset_y 20 -video_size 640x480 
-show_region 1 -i desktop [output]

获取名为Calculator"的窗口的内容:

To grab the contents of the window named "Calculator":

ffmpeg -f gdigrab -framerate 25 -i title=Calculator [output]

我发现帧率 10 非常适合屏幕捕获(您可以更改它).

I found that framerate 10 suits screen capture well (you can change it).

我已经对文件和流输出进行了编码,并且效果很好.

I have encoded to both files and streaming outputs and it works quite well.

这篇关于使用 ffmpeg 捕获 Windows 屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆