---
title: "Cut and Merge Videos Using FFmpeg: A Developer's Guide"
date: 2020-08-17T23:09:48.000Z
author: Z.SHINCHVEN
tags: [FFmpeg, Video Editing, Command Line]
canonical: https://atlassc.net/2020/08/18/cut-video-with-ffmpeg
---
## Introduction

As a developer, I often find myself turning to the command line for tasks that can easily be accomplished without GUI tools. Video editing is one such task. FFmpeg is a powerful command-line utility that allows you to manipulate multimedia data in various ways, including cutting and merging videos.

In this post, I'll show you how to perform basic video cutting and merging operations using FFmpeg.

## Cut Video Using FFmpeg

Cutting a video means extracting a specific portion from it. You can cut by timestamp or by frame number using FFmpeg.

### Cut by Timestamp

```bash
ffmpeg -ss 00:00:30.0 -i input.wmv -t 00:00:10.0 -c copy output.wmv
```

### Cut by Frame Number

```bash
ffmpeg -ss 30 -i input.wmv -t 10 -c copy output.wmv
```

> **Note**: The order of arguments is crucial for successful cutting. Always follow this pattern: `-ss <START_TIME> -i <INPUT_FILE> -t <END_TIME> [other options]`. Failure to do so may result in corrupted output. For more details, consult the [Official Documentation](https://ffmpeg.org/ffmpeg.html#:~:text=position%20(input/output)).

For additional insights on video cutting, refer to the FFmpeg wiki on [Seeking](http://trac.ffmpeg.org/wiki/Seeking).

## Merge Videos Using FFmpeg

Merging videos means combining multiple video files into one.

### Create File List

First, create a text file that lists the videos you want to merge:

```bash
echo file file1.mp4 >  mylist.txt
echo file file2.mp4 >> mylist.txt
echo file file3.mp4 >> mylist.txt
```

### Concatenate Videos

Execute the following command to merge the listed files:

```bash
ffmpeg -f concat -i mylist.txt -c copy output.mp4
```

For more information on merging videos, refer to the FFmpeg wiki on [Concatenation](https://trac.ffmpeg.org/wiki/Concatenate#protocol).

## Conclusion

FFmpeg is a versatile tool for basic video editing tasks like cutting and merging videos. Its command-line nature makes it a preferred choice for developers who are comfortable with terminal commands.

Happy video editing!
