Facing issue with the output video duration

Yes by referring we done the code.
Duration:
input video: 20sec
output video: 2sec or 3sec