Created
February 9, 2018 20:59
-
-
Save mfandl/c107672c00ccf4256767783f8a3e31b2 to your computer and use it in GitHub Desktop.
openFrameworks + ofxVideoRecorder setup to record video with h264
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* openFrameworks + ofxVideoRecorder setup to record video with h264 | |
* You will need ffmpeg and libx264 in your system. On mac, you can use homebrew. | |
* reason for yuv420p: | |
* 'QuickTime only supports YUV planar color space with 4:2:0 chroma subsampling (use -vf format=yuv420p or -pix_fmt yuv420p) for H.264 video.' | |
* as mentioned here: https://trac.ffmpeg.org/wiki/Encode/H.264 | |
*/ | |
recorder.setVideoCodec("libx264"); | |
string fileName = ofToDataPath("v" + ofGetTimestampString() + ".mp4"); | |
recorder.setupCustomOutput(fbo.getWidth(), fbo.getHeight(), 60, 44100, 0, "-vf format=yuv420p -preset ultrafast " + fileName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment