Join AVCHD MTS files with FFmpeg

Simple ways to get AVCHD spans joined.

Tutorial

Many AVCHD video cameras write large video in many MTS fragments. For example, there are typical flash card files from a Sony NEX camera:

00123.MTS	1905 MB
00124.MTS	2026 MB
00125.MTS	2026 MB
00126.MTS	 783 MB
00127.MTS	2003 MB

Here 00125.MTS, 00126.MTS and 00127.MTS are parts of the same recording session: the first two files have the same size 2 GB.

To use these spans in any video editor or media player you should join them together.

Using Windows Command copy

Use a Windows batch command:

copy /b 00125.MTS + 00126.MTS + 00127.MTS out.mts

In some cases this way may not work, so use next methods:

Join MTS Files with no AC3 Recode using FFmpeg

ffmpeg.exe -i "concat:00125.MTS|00126.MTS|00127.MTS" -vcodec copy -acodec ac3 -sn out.mov

AC3 is not supported by DaVinci Resolve before version 14, so you can use next method:

Join MTS Files for DaVinci Resolve (before v.14) using FFmpeg

ffmpeg.exe -i "concat:00125.MTS|00126.MTS|00127.MTS" -vcodec copy -acodec pcm_s16be -sn out.mov

Please note that very long sequences may not be placed in MOV container. You can try MKV instead. Or make MP4 with a near-lossless AAC encoding:

Join MTS Files to MP4 using FFmpeg

ffmpeg.exe -i "concat:00125.MTS|00126.MTS|00127.MTS" -vcodec copy -acodec aac -ab 512k -cutoff 22050 -sn out.mp4

Please note that AAC encoder from FFmpeg has very poor quality, so we use 512k. You can try 320k or less if your audio record is not important. For old FFmpeg versions add -strict experimental.

Using Video Artifact

Extended editions of Video Artifact can automatically join MTS files when importing. They can find all required spans automatically. But a manual joining is required if you use the Basic edition.

Steps to get spans joined are:

1.

Place all MTS spans to the project folder.

2.

Execute import script related to your camera model from va\import\Generic\camera-manufacturer\camera-model.bat.

3.

Get the result in the src/ folder.

Done.