Simple video recorder for linux

videoRecorder.h

#ifndef VIDEO_RECORDER_H
#define VIDEO_RECORDER_H
#include <string>
#include "ofMain.h"

class VideoRecorder
{
private:
    int saveImageCounter;
    bool stop;
    string path;

public:
    void record(string path)
    {
        if (!stop)
        {
            this->path = path;

            string fileName = path + "/frames/" + ofToString(saveImageCounter) + ".png";

            ofSaveScreen(fileName);

            saveImageCounter++;
        }
    }
    void stopRecording()
    {
        stop = true;
        string command_ffmpeg = "ffmpeg -y -r 60 -i " + path + "/frames/\%d.png -vcodec libx264 -pix_fmt yuv420p " +
                                path + "/output.mp4";
        string command_rm = "rm -r " + path + "/frames";
        string commands = (command_ffmpeg + " && " + command_rm);
        system(commands.c_str());
    }
};

#endif

I couldn’t get ofxVideoRecorder to work, so I made another one.