To trim a video using ffmpeg, you can follow these steps. Start by opening your terminal or command prompt. Then, input the ffmpeg command with the following structure:
ffmpeg -ss [start_time] -to [end_time] -i [input_file] -c copy -map_metadata 0
[output_file]
In this command, replace [start_time]
with the desired start time of the trimmed portion, [end_time]
with the desired end time, [input_file]
with the name of your input video file and [output_file]
for the name you want for the trimmed video. For instance, if you want to trim a video from 2 minutes and 2 seconds to 2 minutes and 20 seconds without re-encoding it, you would use the command ffmpeg -ss 00:02:02 -to 00:02:20 -i input_video.mp4 -c copy -map_metadata 0 output.mp4
This command efficiently trims the specified portion of the video without re-encoding, preserving the original quality and metadata. Once the command is executed, the trimmed video is saved under the specified output file name.