September 2018
Intermediate to advanced
380 pages
9h 40m
English
To save video from the OpenCV program, we need to create an object of the VideoWriter class. The code to save a video to a file is as follows:
Size frame_size(640, 640); int frames_per_second = 30; VideoWriter v_writer("images/video.avi", VideoWriter::fourcc('M', 'J', 'P', 'G'), frames_per_second, frame_size, true); //Inside while loopv_writer.write(frame); //After finishing video writev_writer.release();
While creating an object of the VideoWriter class, the constructor takes five arguments. The first argument is the name of the video file you want to save along with the absolute or relative path. The second argument is the four character code used for video codec. It is created using the VideoWriter::fourcc function. ...
Read now
Unlock full access