Use the following command to trim a MP4 file.
ffmpeg -ss 00:02:45 -t 00:04:00 -i source.mp4 -c copy output.mp4
-ss 00:02:45 : You can trim the video from beginning ( set this parameter to 00:00:00) or in the middle. In this example, the output will start from 2mins and 45 seconds from the original video.
-t 00:04:00 : duration that need. In this example, the output will start from 02:45 of the source video and stop at 06:45.
-c copy : use the same codec with the source file