A video file can be undistorted by looping through each frame and undistorting them . vision.VideoFileReader() function will create the video file reader. vision.VideoPlayer() sets the player window. vision.VideoFileWriter sets the video file writer variable. Using these you can undistort the video file.
This sample code will provide a better understanding.
vfrUndist = vision.VideoFileReader(videoFile);
vpUndist = vision.VideoPlayer(required name value arguments);
vfwUdist = vision.VideoFileWriter(required name-value arguments);
frame_undist = step(vfrUndist);
frame = undistortImage(frame_undist,cameraParams);