The key to the solution of your problem is the “FrameRate” property of the “VideoWriter” object. If unspecified, the “FrameRate” property defaults to a value of 30 FPS. Hence the video output in your case is at 30 FPS. To change the output frame rate to 240 FPS, you need to explicitly set the “FrameRate” property to 240 FPS. The following code snippet can help you to solve your problem.
reader = VideoReader("inputVideo.avi");
writer = VideoWriter('outputVideo.avi');
writer.FrameRate = 240;
img = readFrame(reader);