Development

Cutting a video into segments with FFmpeg

Creating video segments from a large video can easily be achieved with FFMpeg, the process is fully automated complete with sequential file naming.

Cutting a video into 5-minute segments can be done with the following:

ffmpeg -i videotocut.mp4 -c copy -map 0 -segment_time 00:05:00 -f segment segment%03d.mp4

This will save the outputted files as segment01.mp4, segment02.mp4 etc…

It will copy the input video and only do the cut with no encoding, this means it will run at a very quick rate.

Note in cases the video won’t be a perfect cut at 5:00 as it will cut on the next keyframe after 5:00, often the length will still be 5:00 as there are many (25/30/60) frames per second.

To do a different length of segments simply change the 00:05:00 value. 00:10:00 is 10 minutes and 00:02:00 is 2 minutes as an example.

Share
Tags: FFmpegHow to

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago