Merging or splitting videos with FFmpeg

Merging and splitting videos can be a pain in the neck and you may find yourself looking for expensive software. However, I may have an easy recipe. Have you ever heard about FFmpeg?

What is FFmpeg?

FFmpeg is “a complete, cross-platform solution to record, convert and stream audio and video”. It is available for Mac, Windows and Linux. Go to for more information.

How to merge videos with FFmpeg?

There are several ways to merge videos. Generally, I use the following method:

ffmpeg -f concat -i concatfile.txt -c copy -sn -y

In this case, “concatfile.txt” is the list of files that you want to merge. This a normal text file with each line being a path to a file.

What is the meaning of these options?

According to FFmpeg documentation:

-f fmt (input/output)

           Force input or output file format. The format is normally auto

           detected for input files and guessed from the file extension for

           output files, so this option is not needed in most cases.

-sn (output)

           Disable subtitle recording.

-y (global)

           Overwrite output files without asking.

-c[:stream_specifier] codec (input/output,per-stream)

-codec[:stream_specifier] codec (input/output,per-stream)

           Select an encoder (when used before an output file) or a decoder

           (when used before an input file) for one or more streams. codec is

           the name of a decoder/encoder or a special value “copy” (output

           only) to indicate that the stream is not to be re-encoded.

How to split videos with FFmpeg?

Example for splitting video from “00:80:00” to “00:09:00”.

ffmpeg -ss 00:08:00 -i VideoInput.mp4 -ss 00:01:00 -t 00:01:00 -c copy VideoClip.mp4

This results in a video which is 1 minute length.

Read more

FFmpeg FAQ – How can I concatenate video files?

FFmpeg Wiki – Concatenate

Stackoverflow – Concatenate two mp4 files using ffmpeg

SuperUser – Using ffmpeg to cut up video


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s