How to trim a video while preserving the metadata?

Hi Reena,

FFmpeg provides two parameters for trimming the video. -ss option allows you to seek video at a particular position it takes value in HH:MM: SSstrong text format or in absolute seconds. -t options allow you to read a specified number of seconds from the video which also takes value in the same format as -ss. So with the combination of both -ss and -t you can trim a video.

For mapping metadata, you can use the -map_metadata parameter provided by FFmpeg. This parameter with 0 strong textas its value will copy all the metadata from the source to the target video file. If you have only metadata types in your source video file then you have to map them individually.

Don’t forget to read about SAR and DAR metadata in FFmpeg

This will help you to understand more about this concept.