ofxSurfingCapturer is an openFrameworks addon to do fast video capturing but storing still frames to join to video with FFmpeg after capture finished. It helps on all the capture workflow.
Includes the main class:
ofxSurfing_CaptureWindowStills.h
It's much faster (in some machines) because captures and compress still frames (.tif) using threading, and it makes the FFmpeg video (.mp4) encoding using system command-line after all: inisde the OF App or using your favourite external video encoder.
Based on: ofxTextureRecorder.
Uses ofxSurfing_CaptureWindowStills.h
-
F8 : Mounts/prepare the capturer...
-
F9 : START Recording!
-
F9 : STOP Recording.
-
F11 : RUN the FFmpeg script to join all the still frames (
xxxxx.tif
->output.mp4
). -
Your videoplayer will auto-start opening the new created video!
- Ctrl+Alt+BackSpace: Remove all still files.
- Faster than other live-capture-to-video alternatives (bc "raw" still frames + post-encode after).
- GPU Hardware accelerated (or CPU) video encoding. (Nvidia only yet)
- Selectable image format: png, jpg, ...etc. tif by default.
- Key commands to handle all the workflow:
- Mount (F8)
- Record (F9)
- Take PNG Snapshot (F10)
- Clear all stills (Ctrl+Alt+BackSpace)
- Auto-call batch FFmpeg stills_to_video compression after capture finished (F11),
auto-opens video with your videoplayer.
#include "ofxSurfing_CaptureWindowStills.h"
CaptureWindow capturer;
ofApp::setup(){
// disable depth to avoid some fbo problems/bugs when using 2D scenes.
//capturer.setDephEnabled(false);
// to capture a section only. call before setup
//capturer.setCustomizeSection(ofRectangle{ 0, 0, canvasSize.get().x, canvasSize.get().y });
//capturer.setup("Captures\\Captures_Projector_1\\", OF_IMAGE_FORMAT_TIFF);
capturer.setup();
// add enabler into your gui
//gui.add(capturer.params);
}
ofApp::draw(){
capturer.begin();
///----- draw your scene here -----///
capturer.end();
capturer.draw();
capturer.drawInfo();
//gui.draw();
}
- To use ofxSurfing_CaptureWindowStills:
https://github.com/moebiussurfing/ofxTextureRecorder
forked from arturoc/ofxTextureRecorder.
Already included into addon/libs
. You don't need to add into Project Generator.
- Includes some FFmpeg scripts, links and a Windows
ffmpeg.exe
and macOSffmpeg
binary. - Video encoding, batch-join stills (xxxxx.tif) to video (output.mp4) requires
ffmpeg
binary. ofxSurfing_CaptureWindowStills.h
could work on macOS and Linux too, bc only relays intoofxTextureRecorder
.- TODO: Check if window resize don't breaks Fbo capturer size...
- FFmpeg encode using
AMD GPU
could work because now you can customize the script on setup.
- Windows10 / VS2017 / OF +0.11
- macOS High Sierra / Xcode 10 / OF +0.11
Addon by @moebiusSurfing
(ManuMolina). 2020.
Thanks to the coders of the above original addons:
arturoc.
MIT License.