Methods for Screen Recording? / ffmpeg help

I want to record video, not just of the contents of the oF window, but whatever is on a given monitor. This recording should be activated by other parts of my code and I’d prefer the code be contained in the app.

This addon from @oxillo looks the most promising:

oxillo/ofxScreenRecorder: an openFrameworks addon to record screen content using ffmpeg libs (github.com)

but I’m having trouble setting up the ffmpeg lib:

I’ve downloaded ffmpeg from GitHub - FFmpeg/FFmpeg: Mirror of https://git.ffmpeg.org/ffmpeg.git and copied the folders

ibavcodec, libavutil, libavformat and libswscale, as listed in avpp.h

as they are, without building anything, and, when building a project using ofxScreenRecorder I get the error that pixfmt.h has #include “libavutil/avconfig.h”, but the libavutil has no such file.

Looking at ofxHapPlayer, the libavutil folder included in that does have an avconfig.h. Copying that, or the whole folder gets rid of that error.

I still get unresolved external symbol errors, so I probably need to build a lib file from the ffmpeg source and add it as a dependency in VS… or something. Any tips?

After some more digging in the forum archives, I found ofxWindows, which includes a screen capture function (in a surprisingly small amount of code). Just doing this works:

//ofxWindowsScreenGrabber m_screenGrabber
void ofApp::update(){
	m_screenGrabber.grab(0, 0, 1920, 1080);
}

//--------------------------------------------------------------
void ofApp::draw(){

	ofTexture tex;
	tex.allocate(m_screenGrabber.pixels);
	tex.draw(0, 0);
}

so thanks to @perevalovds . This saves me from having to torture myself trying to get ffmpeg to work…