FrameGrabber is a class that feeds you with Audio-Frames,Video-Frames,FrameRate, Sample Rate etc. You just need to create an instance of this class with the path of the video file as a parameter.
then, FrameGrabber.grab() will give you frames of the audio at the same frame rate as the input video. If FrameGrabber.grab() returns null, then this would mean that the video has been iterated to its last frame.
Now you can set up a new grabberObject, with the path of your second video as parameter to its constructor and repeat step 2
You can repeat step 3 untill all your videos have been read.
Now to record the video; You can initialize the recorder with parameters returned from the FrameGrabber. Its Height,width,frameRate,samplerate all can be set exactly to match the grabber object. Also you need to set a path where the recorder will save the video. After each FrameGrabber.grab(), you need to call recorder.record(FrameGrabber.grab()).
Now the the point where you feed the new video to the FrameGrabber(), following will be the reason of quality-lags:
a) The frameGrabber takes time to set up. The transition/shift to the new video path that will be assigned to the grabber, will not be instantaneous. This can take time in the order of seconds.
b) This transition/shift to the new video path, will also have to change parameters of recorder-Framerate,SampleRate,Height & Width.
To handle both these issues you will need to handle the first frame added after a transition/shift to the new video path, as a special case. Here you would reset the properties of recoderFramerate,SampleRate,Height & Width to match the new frameGrabber properties.
This implementation should work fine.
Moreover duplicating frames in case you want to increase frame rate, and skip frames when I need to decrease frame rate. Both these will distort the video completely. You can never match up to the original quality of the video. More over the lag in video frames and sound would clearly evident.