屏幕截图C ++(视频) [英] Screen capture c++ ( Video )
问题描述
早上好.
我一直在寻找一种以全屏或特定坐标x/y捕获音频的从屏幕"捕获视频的方法.
我已经尝试过ffmpeg,但是我找不到很好的教程,每个人都使用需要静态版本来记录的命令行,即使我尝试了它也说输入/输出错误没有屏幕设备"
我尝试过Directx,起初我想寻找一种捕获视频的方法,但仍希望能找到我,但我只是为了进行测试而尝试了此操作.
Good morning.
I''ve been searching for a way to capture a video " from the screen " with audio at full screen or at a specific coordinate x/y.
I''ve tried ffmpeg I couldn''t find a good tutorial + every one uses the command line which needs the static version to record , even when I tried it it says input/output error " no screen device "
I tried Directx , at first I searched for a way to capture a video I''m still looking hopefully I''ll find but I tried this just for the sake of testing..
IDirect3DDevice9* g_pd3dDevice;
void MainWindow::capture_video(){
IDirect3DDevice9* g_pd3dDevice;
void MainWindow::capture_video(){
IDirect3DSurface9* pSurface;
g_pd3dDevice->CreateOffscreenPlainSurface(100, 100, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &pSurface, NULL);
g_pd3dDevice->GetFrontBufferData(0, pSurface);
std::string path1=path.toStdString();
LPCWSTR a=(LPCWSTR)path1.c_str();
D3DXSaveSurfaceToFile(a,D3DXIFF_BMP,pSurface,NULL,NULL);
pSurface->Release();
}
但是当调用此函数时会崩溃..
我搜索了直接放映,但找不到我不知道为什么.
因此,您是否可以将我定向到一个图书馆/方式来进行此操作,并提供良好的教程,因为我是新手.
but it crashes when this function is called..
I searched for direct show but couldn''t find it I don''t know why.
So could you please direct me to a library/way to do this and with good tutorials since I''d be new to it.
推荐答案
在StackOverflow上有人这样做了使用 openCV [ ^ ].可以在这里找到代码:
http://stackoverflow.com/questions/14148758/how-to-capture-the-desktop-in-opencv-ie-turn-a-bitmap-into-a-mat [
On StackOverflow somebody did this using openCV[^]. The code can be found here:
http://stackoverflow.com/questions/14148758/how-to-capture-the-desktop-in-opencv-ie-turn-a-bitmap-into-a-mat[^]
这篇关于屏幕截图C ++(视频)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!