Pages

Joining My AVCHD Videos

Tools to join AVCHD videos

I use two free tools to join my AVCHD files. The first is called tsMuxeR and the second is called eac3to.

tsMuxeR is a free tool developed by SmartLabs that can join AVCHD files. The tsMuxeR package has a graphical user interface (GUI) and a command line interface. The processing speed is very fast. It takes only a few minutes to join an hour of AVCHD clips on my computer with an Intel dual-core T9500 processor. The command line interface is a very nice feature. It lets me run the tool more automatically using a DOS batch file.

However, there is one major problem with tsMuxeR: the audio of the joined file is out of sync with the video. This problem becomes more severe when there are more AVCHD files to join. It appears that tsMuxeR may not join the audio portion of the AVCHD files properly. Fortunately, this problem can be overcome by using eac3to together with tsMuxeR.

eac3to is free tool developed by madshi.net that can extract and join the audio portion of the AVCHD files. Unlike tsMuxeR, the eac3to package only provides a command line interface, although there third-party GUI packages available. However, I prefer to use the command line interface and run the tool more automatically using a DOS batch file. The processing speed is also very fast. It also takes only a few minutes to join an hour of AVCHD clips on my computer.

To overcome the tsMuxeR out-of-sync problem, I first use eac3to to extract and join the audio portion of the AVCHD files. I then set up tsMuxeR such that it does not join the audio portion of the AVCHD files by itself but merges the joined audio file generated from eac3to instead. In this way, the audio of the joined AVCHD file is perfectly in sync with the video.

Setting up the tools

I do the following to set up tsMuxeR and eac3to.

  1. Create an AVCHD working directory in, e.g., the "My Document" folder.
  2. Download tsMuxeR from here.
  3. Extract the downloaded zip file and copy the entire tsMuxeR folder to the AVCHD working directory. If the name of the extracted folder is not "tsMuxeR", rename it to "tsMuxeR".
  4. Download eac3to from here.
  5. Extract the downloaded zip file and copy the entire eac3to folder to the AVCHD working directory. If the name of the extracted folder is not "eac3to", rename it to "eac3to".

After the tools have been set up properly, the AVCHD working directory should look like this:

Working Directory

The tsMuxeR directory should look like this:

tsMuxeR Directory

The eac3to directory should look like this:

eac3to Directory

Runing the tools

Both tsMuxeR and eac3to can be run via a GUI. However, my experience with the tsMuxeR GUI is that it is rather tedious to add many files to the file list. It is also easy to miss adding some files to the file list. Fortunately, tsMuxeR as well as eac3to provide a command line interface so that I can run them more automatically using a DOS batch file.

I follow these steps to join my AVCHD files:

  1. Remove any old AVCHD and DOS batch files already in the AVCHD working directory.
  2. Copy the new AVCHD files to the AVCHD working directory.
  3. Create the DOS batch file from my Creating the Joining Batch File page.
  4. Copy the batch file to the AVCHD working directory.
  5. Click the batch file. A DOS window will appear.
  6. Wait for the message "AVCHD Joining Complete" and press a key to close the DOS window.
  7. Play the joined AVCHD file.

Video

Here is a video showing the above procedure:


67 comments:

Jose Allende said...

I rarely take the time to leave comments, but felt obligated to do so in this scenario:

Dude, you totally rock! This is a great tutorial (actually, more than a tutorial because you did all the work!)

I was getting so frustrated with finding a solution for joining my .m2ts files w/o re-rendering and w/o the out-of-sync audio issue experienced with tsMuxeR alone. This worked perfectly on the first try. I was able to join 30+ .m2ts files resulting in 1hr 20min of uncompromised 1080p footage with perfectly synchronized audio.

The batch script generator was a great touch. Absolutely fool proof! Really appreciate the well informed solution presented intelligently w/o all the arrogance one usually finds out there in forums nowadays. Thank you!

zamo said...

Couldn't agree more. Thanks for providing the steps and batch code generator. This has worked great for me. I have searched all over the place and finally found this.

Thanks!

Anonymous said...

Extremely useful. Solving the lip sync issue was a master stroke. I spent days looking for something like this. I did use multiAVCHD before, but it seems it is not support much any more. However, this is so much easier. It recognised the 1440x1080@50i footage from my Sony HX-5V digital camera's SD card. The files Sony PMB PC software imports are randomly numbered, so I needed to dump back in the SD card. Thank you. Carlos

Phil said...

Happened on this site after a bit of googling around to get files concatenated for PS3 playback and the avoidance of any transcoding

Perfect tutorial - so rare to find these in cyberspace - thanks for taking the time to share it!

Anonymous said...

It joined all the files into one m2ts file, however, got an error message saying that Windows Media Player does not support this type of file, because of codec or something like that error.

DK said...

You may want to install and use "Splash Lite" in your computer to play m2ts files. Please see the "Playing My AVCHD Videos" page in this site.

Nadeem said...

Absolutely brilliant website. I have spent hours on the web looking at ways of making all my multiple snippets of video into a seamless movie, and you are the ONLY ONE who has explained it so well and given us tools that work. All for free!! Thank you sooo much!!!

Anonymous said...

DK:
These are bluray m2ts decrypted files, on win 7. Your program successfully merged all the little m2ts files into one single m2ts file. However, they would not open in Windows Media Player: The error says the following: "WMPlayer cannot play the file. The Player might not support thee file type of might not support the codec that was used to compress the file". It would not open in Splash Lite or Arcsoft Total Media Player, Media Player Classic, VLC media Player, Windows Live Movie maker etc. Now the individual files before merging into the one m2ts plays on all of the above players. It would be wonderful, if your program worked, must be something minor you need to do. This was bluray files, I have not tried on any other files.

DK said...

Thanks for the comment. I have not tried bluray files. Maybe some special tsMuxeR settings are needed to join these files correctly. If I have time, I will try to look into this problem. It would help if you could provide a link to some public bluray file samples that I can use to test.

Anonymous said...

I joined mts files from Pana TM700. Everything is OK but PGS (Subtitle for date and time recorded) is missing. How can I can put some parameter in batch file to keep PGS.

DK said...

Thanks for the comment. PGS is supported by tsMuxeR but, unfortunately, is not supported by this version of the batch file generator. When I have time, I will try to look into this more.

Anonymous said...

I was so happy when I found this page and got my audio synced when joining the mts file but now I noticed that the subs with date and time is missing! I hope you have time to check this really soon.

Thanks from Sweden!

DK said...

"I was so happy when I found this page and got my audio synced when joining the mts file but now I noticed that the subs with date and time is missing! I hope you have time to check this really soon."

Can you check if the following works:

(1) To the batch file generated from this web site, add the following two lines after "set tsCommand4=A_AC3, %audioFile%, track=4352"

set tsCommand5=S_HDMV/PGS
set tsCommand6=bottom-offset=24,font-border=2,text-align=center,video-width=1920,video-height=1080,fps=, track=4608

(2) Also add the following line after "echo %tsCommand4% >> %metaFile%"

echo %tsCommand5%, %mtsList%, %tsCommand6% >> %metaFile%

Anonymous said...

(1) To the batch file generated from this web site, add the following two lines after "set tsCommand4=A_AC3, %audioFile%, track=4352"

set tsCommand5=S_HDMV/PGS
set tsCommand6=bottom-offset=24,font-border=2,text-align=center,video-width=1920,video-height=1080,fps=, track=4608

(2) Also add the following line after "echo %tsCommand4% >> %metaFile%"

echo %tsCommand5%, %mtsList%, %tsCommand6% >> %metaFile%
-----------------------------------


Works like a charm! Date and time as subs! I can´t tell you how gratful I am! Thanks! Would be great if (as someone already mentioned) this batchscript could be downloaded in some way so Internet connection wasn´t necessary. Thanks again!
/Patrik

bigrig said...

Thanks for posting your information on joining AVCHD clips. I think multiAVCHD basically does the same thing (tsmuxer + eac3to) with a GUI interface. I haven't tested it much, but so far I am pleased.

Anonymous said...

Sorry Im a bit of a noob, love your work

I need to know how to keep the original sound source, in this case TrueHD & the English subtitles

Thanks in advance

Anonymous said...

Sorry forgot to ask, is it possible to auto add chapters at each join?

DK said...

I just looked at eac3to's wiki page (http://en.wikibooks.org/wiki/Eac3to/How_to_Use) again and could not find any option to keep TrueHD audio. As for subtitles, you can try my solution posted above (i.e., comment on PGS, January 19, 2012). Finally, I don't think tsMuxeR can be used to add chapters when joining AVCHD files. Hope this helps.

Anonymous said...

This worked great for me also! Thanks! I am having problems when I bring it into Premiere Elements 9. The audio is gone. I can hear the audio when I watch the video in Windows. Any idea why? Thanks.

DK said...

I have Sony Vegas which seems to work fine with the joined AVCHD files.

However, I don't have PE9 and therefor can't help you much.

Some googling does show other people are also having similar problems with PE9. Maybe you can find some help there.

Martin said...

Thanks a lot.
That works graet!
BTW, I have 2 qs.

1. If I want to join 2 dif types of files with dif frame rate(e.g. 60i=29.97fps and 60p=60fps), how can I do? I tried your way, but there's a sync error.

2. I want to play some AVI files in my camcoder. For playing the movie, I should change file format to AVCHD(mts files). Do you know any program to convert AVI to MTS except SONY VEGAS?
(Sony vegas is too slow)

DK said...

@Martin,

In the batch code, there is a line:

set tsCommand3=fps=, insertSEI, contSPS, track=4113

Try to change fps= to fps=xxx where xxx is one of the frame rates. If this does not work, maybe we just cannot join two files with different rates using this method.

As for AVI conversion, you can try Freemake Video Converter. I find it to be much easier to use than Sony Vegas but I am not sure if it faster not not.

Anonymous said...

I purchase HD AVCHD video Camcorder HDR- CX560V.I was so happy when I found this website.All information of this web site extremely useful.I joined my M2TS 1920-1080 file in one single file easily.Thank you so much!!! To play HD AVCHD file I recommend Splash Pro EX player.The best player for this file ( or Window Media player ).Thank you so much!!!

Anonymous said...

I thank you sir. It's been a longtime aggravation of mine ever since my first HD camcorder about 5 years ago, how to simply join mts or m2ts files very quickly with no edits. It's hard to believe software to do this very simple and obvious task is so difficult to find. There was some fairly awful software that came with a Canon camcorder I no longer have that would do it, but it doesn't work unless you plug the actual camcorder in and the files were taken with that camcorder . . . typical locked down proprietary junk software.

I tested this and it works both with my camcorder files and with BluRay formatted files. Once the batch is running it works very fast, obviously far faster than any kind of re-encoding rendering like a normal video editor. The resulting joined file plays quite perfectly and the audio is in sync. Wonderful.

I also looked at the .bat file and figured out how to alter it by hand, it's quite simple, though for a large number of oddly named files, your batch generator will come in handy.

Anonymous said...

A Thousand Thanks!!!

kato said...

Hello,
great work,
but i have a problem.
I want to merge 168 files with about 12 GByte.
But as result i get only 1 file with 4 GByte.
Are the files splitted at every 4 GByte ?
But where is the rest ?
What can i do ?
Can someone please help me.

Thanks

Martin said...

Hi, DK.

Long time I've visited here.

I'm curious whether you have any clue on this.
I think you would know.

Editing .pls files. especially combine multiple .pls files into one.


I have a SONY CX500 handycam.
When I use MultiAVCHD to make AVCHD format structure collection with only movie clips,
many .mpl files were made corresponding .mts files.

But the thing is when I play this AVHCD structure with total media theater or Blu-ray player
I could not see seamless one movie rather just split movie clips.

Actually, When I use handycam, no matter how many clips I shoot(so how many ,mts files were made),
I would find just 1~2 .mpl files in the PLAYLIST folder.


What I'm looking for is either (a) a way to combine playlist(.mpl) files into one or (b) how to make a new playlist(.mpl) files for multiple video clips.

My motivation is to split long AVCHD movie collection into 2~3 to store in DVD-Rs or BD-Rs.
(such as Disc 1: 1~99 clips(.MTS), Disc 2: 100~200 clips(.MTS) )

Would you give me any clue on this?
Thank you.

DK said...

Kato,

I think your files are probably stored in a drive formatted in FAT32 which has a 4GB file size limit. If you use a drive with the usual NTFS format, this problem should go way.

DK said...

Martin,

Can you just combine the, e.g., first 99 .mts files into one large file and store in Disc 1 and so on?

I really don't have much experience with .pls fils. I normally just combine the small .mts files into one and play the combined file on my PS3.

Maybe someone reading this post can comment on this.

Martin Abel said...

Thank you so much! This manual is absolutely awesome! Thanks for taking all the time to work this out and share it.

Anonymous said...

Dude to totally rock. Believe me I was struggling joining mts files for the last 1 week. Everytime I googled around I was getting new results and I must have followed atleast most of them if not all. All of them proved to be doing only half of the job for me and each time I was getting more and more frustrated. Initially I thought the solution which you had provided also to be one to add to my frustrataion. However, after seeing the end result following the steps mentioned by you I was amazed. Works perfect and finally my frustration has come to an end. Good job and thanks a ton.

Anonymous said...

Just another "Thank You" from somebody that is very pleased to have a joined m2ts file that has synchronized audio!

Anonymous said...

TOTALLY AWESOME! and THANK YOU!!

Once the batch file is generated, is it ok to use it again, by modifying the "new file's" name in line 3 and the names of the files to be joined, in line 4 ?

DK said...

Yes, you can modify the batch file to process new input files. But it may be easier just to use the batch file generator in this website.

Dr. D-Dub said...

Your steps seem very clear, but for some reason when I run the AVCHD.bat file, it says "joining complete" but there is no joined file. I've repeated the steps numerous times but for some reason it's not generating a single file (or any file for that matter). Anyone else having this trouble? Any help is appreciated!

DK said...

@DR. D-Dub, I have not run into this problem. But please make sure you put the files in the correct folders.

umbertosm said...

thank you very much, Your method works great!

umbertosm said...

Thank you very much, Your method works great!

Salvijus said...

Unbelievable! It's my first attempt to join videos and it worked... Thank You very very very much!

october said...

Very good tool.
Thank you.

Senthine said...

This... Is... Epic! I'm so happy that I found this site and that you made this tutorial. I can finaly join files from my TM900 since I deleted HD Writer info files. And the result is just perfect. Thank you very much!

Joop Liefaard said...

I followed your instructions as well but at the end the joinedACVHD file is not created.
I receive the message ACVHD joining completed...press any key to continue. That is all. No file. What can I do to solve this.

Joop.

DK said...

Joop, I am not sure what went wrong in your case but please make sure you place all the files in the correct folders. The batch script always outputs the completion message regardless if things have gone wrong or not.

Anonymous said...

This, surely is a wonderful job that you have done. It saved my day. Thank you!

Thiru said...

Thanks a lot. You have made me very happy. I have Roxio Creator 2011 Pro. Tried to use Roxio to join mts files from Sony SR12E. So many crashes. When no crash audio did not sync. I have wasted lot of time with this Roxio "professional" sw.

Using your method I was able to join the files very quickly and they all work perfectly.

Thanks again

Anonymous said...

Works great. I've been joining my files using Corel Visual Studio X5, but I notice they have compression artifacts.
That's because anytime you encode your
gonna add artifacts, and the bit rate is half the camcorders(TM900). So the files are twice as big, but I don't care, since hard drives are so cheap and big now. I noticed a few error messages when running the batch file, saying some audio segments were overlapping 20 ms or so, but the final file had no problems. Great job. Steve

Anonymous said...

Good idea. Unfortunately I can't make it work.
I need to run it in a DOS command prompt window, and everything seems alright, except that tsMuxeR CLI says that some parts "appear to be broken". None of my segment files are broken or corrupted, and they can be played seperately with any MTS capable media player. The files were created by my Denver DVB-C tuner.

It still outputs a file though, but it's only 351 mb (that's at least 1 gb too small given the source input), and it appears only to contain audio or nothing at all.

I used XMedia Recode to convert the files to MP4 or MKV. After that the segments can easily be joined together by other GUI tools like MKVtoolnix or Freemake Video Converter.

Use this method if you encounter the same problems.

Shadow said...

Hi,

Followed all this to the letter.
Unfortunatley when i play the joined file with VLC player it plays the video a around twice the speed with the audio normal. This is the same as when i tried to use tsMuxer on its own. In other words eac3to with Dos had no effect. I am confused. Any help would be appreciated. The dos command works fine and indicates a successful join. But the picture speed is way too fast.

DK said...

This method may not work for some video files from non-Sony camcorders.

Anonymous said...

Absolutely fantastic. Really appreciate your work dude, thanks a million.

Anonymous said...

Worked a treat thankyou ever so much.

Derrick D said...

I used this method for joining 4 files (3 of which were 2GB each). This method was super fast and worked perfectly. Thank you for sharing your knowledge. It made saving memories and sharing them so easy!

Anonymous said...

Thanks for publishing this, it clearly works in a lot of cases. Not for me :( Mine are Canon camera files. I follwed your instructions to the letter but no joined file created. I am attempting 9gb, 145 files. It immediately says 'press any key'. Tsmuxer works fine on this batch of files but the audio is increasingly out of synch. Ah well.

Anonymous said...

Hi again. Just tried it with only 5 small files and still nothing created.

Anonymous said...

Amazing, thanks so much for posting this AND the generator! Worked on the first try after several other tutorials and tools failed (didn't work at all or resulted in out-of-synch audio). Again: thanks a ton!!

Anonymous said...

Worked Perfectly. Thank You.

Anonymous said...

Fantastic job!!!

Anonymous said...

Unfortunately with this method the date code is being removed from the video.
When I use TSMuxer GUI only and join the files manually, the date code is not being removed.
It would be nice to have a batch files method only using ts muxer without altering the streams within the video file and keeping the date code.
The date code can be switched on and off as subtitle in the video player such as VLC or Kodi.

Anonymous said...

THANK YOU SO MUCH

Unknown said...

Hi

I really appreciate the tutorial but unfortunately it doesn't work with my files that were created with a Panasonic camera. Do you have a suggestion?

MJW said...

Wow! Thanks for publishing this method of joining MTS files. I had two files of around 2GB and they are now joined perfectly. Really Fantastic!

Unknown said...

Savior!

Ajaz said...

Works wonderfully, any chance you can update the code to automatically add the subtitle stream aswell??

Anonymous said...

6 years after the first post, and I'm happy to report your solution is still exceptional. I'm a father of 4 who video's a lot and keeps everything on my PS3/PS4 for viewing. This is a simple and eloquent solution for maximizing resolution & audio. I use it to join files from a Sony A7rii. The resulting video is fantastic.

Many thanks for taking the time to document/code/explain/help the rest of us. It's truly appreciated.

Unknown said...

Just wanted to thank you for the time and effort that you have put into your 'My AVCHD Videos' blog. I have been using your tools for a couple of years now and it is perfect. I don't know what I would do without is so please don't let this blog disappear because I would be lost without it. Thanks again, Mick.

Ajay said...

This is really a super piece of work. Has probably saved many people hours of work.
I need help with 2 things.
1)
When I run the batch file, I get the following output.


Z:\backup\MOVIE\BDMV\STREAM>Rem Batch code starts here ...
You're trying to join m2ts parts with different track properties (2).
Network Optix tsMuxeR. Version 2.6.12. www.networkoptix.com
Can't open file: .\00.ac3
Could Not Find Z:\backup\MOVIE\BDMV\STREAM\00.ac3
AVCHD Joining Complete.
Press any key to continue . . .


Why am I getting the error Can't open file: .\00.ac3?
I am stuck on this, any help will be much appreciated.
Interesting thing is that this worked once when I created the target and 00.ac3 file in a different folder.

2) When I play the combined file, i notice that there is audio description in the result file. How do I get rid of that?

Anonymous said...

Still working in 2021. Downloaded both tools and followed instructions.

Was able to join videos from my old camera for Youtube upload.

Perfect!