在C或C ++和Linux的屏幕捕捉程序 [英] screen capture program in C or C++ and Linux

查看:133
本文介绍了在C或C ++和Linux的屏幕捕捉程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找一个程序使用C或cpp捕获屏幕在Linux中。有人可以帮助给人一种骨架结构或程序有什么可以帮我。

I am looking for a program to capture screen in Linux using C or Cpp. can someone help with giving a skeleton structure or program what can help me.

感谢和问候,
RC

Thanks and Regards, RC

推荐答案

<一个href=\"http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20grab%20the%20desktop%20%28screen%29%20with%20FFmpeg\"相对=nofollow>如何捕获屏幕的ffmpeg:

使用的x11grab设备:

Use the x11grab device:

ffmpeg的-f x11grab -r -s 25 -i 1024×768 0.0 + 100,200 output.flv

ffmpeg -f x11grab -r 25 -s 1024x768 -i :0.0+100,200 output.flv

此将桌面抓取图像,开始与左上
  角点(x = 100,Y = 200)的1024×768的宽度和高度。

This will grab the image from desktop, starting with the upper-left corner at (x=100, y=200) with the width and height of 1024x768.

如果你需要的音频也可以使用ALSA是这样的:

If you need audio too, you can use alsa like this:

ffmpeg的-f x11grab -r -s 25 -i 1024×768 0.0 + 100,200 -f ALSA -ac 2 -i
  脉冲output.flv

ffmpeg -f x11grab -r 25 -s 1024x768 -i :0.0+100,200 -f alsa -ac 2 -i pulse output.flv

所以,你可以简单地把这个在 capture.sh 并从code运行它:

So you can simply place this in capture.sh and run it from your code:

#include <cstdlib>

int main(){ std::system("./capture.sh"); }

如果你必须这样做,而不调用外部工具,您可以使用 libffmpeg直接。

If you have to do it without calling external utilities, you can use libffmpeg directly.

这篇关于在C或C ++和Linux的屏幕捕捉程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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