GH1 .mts files - how do you join them?

Appleman

Member
How do you join the numerous .mts files from the GH1 into one playable file keeping the original quality? Some editors will join them but will render them to a single file. Rendering will affect the quality. I just want to join them together. I've tried tsmuxer but it didn't work out properly - the joined file looked a bit corrupted. I have found tsmuxer never worked as expected.
 
I don't quite understand this... I have .mts files that are 6 gigs... people tell me the camera is fat32 and will split files after 4 gigs but this does not appear to happen on my camera... I have one long hour and a half clip that is like 6.5 gigs
 
Try MTS Merger its free and works great

http://vontraining.net/download/

I wrote that tool, but I can assure you that it'll only work when the clips have been split inside the camera due to the FAT32 file size limit.

Some more details though:
I tried arbitrary clip joining when I got my HMC way over a year ago and found no working solution. Now a year later I know some of the technical details although this doesn't help you a lot: .mts files are not meant to be joined unless they're split by the FAT32 file size limit (in that case it's a simple copy operation).

In theory it should still be technically possible to join arbitrary .mts files as long as they have the same elementary streams and their properties are compatible, but as far as I know there is no tool which accomplishes this task.

I don't quite understand this... I have .mts files that are 6 gigs... people tell me the camera is fat32 and will split files after 4 gigs but this does not appear to happen on my camera... I have one long hour and a half clip that is like 6.5 gigs.
It is a technical limitation of the FAT32 file system used by SD and SDHC which can't be overcome.
 
Last edited:
I wrote that tool, but I can assure you that it'll only work when the clips have been split inside the camera due to the FAT32 file size limit.

Some more details though:
I tried arbitrary clip joining when I got my HMC way over a year ago and found no working solution. Now a year later I know some of the technical details although this doesn't help you a lot: .mts files are not meant to be joined unless they're split by the FAT32 file size limit (in that case it's a simple copy operation).

In theory it should still be technically possible to join arbitrary .mts files as long as they have the same elementary streams and their properties are compatible, but as far as I know there is no tool which accomplishes this task.


It is a technical limitation of the FAT32 file system used by SD and SDHC which can't be overcome.
Interesting I joined 3 mts files with your program and merged them as one file and it plays back in splashlite. How is it doing that?
 
MTS streams have embedded time and sequence codes at multiple levels. If you try to just append them to each other the results will be inconsistent time and sequence codes. Editors allow you to do this, but they replace all the timing and sequencing data in the process. It's actually a pretty complicated process. You basically have to completely decode the streams and re-encode them to do it properly.

The file splitting that happens at the 4GB limit is a different issue - they are coherent streams that have the correct timing and sequencing data already in them - they just happen to be split into multiple files. When you stop recording and then restart, the timing and sequencing parameters are reset when the new clip starts and thus the clips can no longer simply be appended.

Chris
 
Last edited:
To elaborate on the timing/sequencing... A MTS stream is composed of 192 byte packets. Each of those packets have a timestamp which is reset to 0 when you start recording. The time stamps are expected to be in sequence. There are several different packet types - directory stuff, I frames, P frames, audio, clock beat, clock timing, etc... Each of the packets types have their own sequencing counters (called continuity counters). For example, each I frame has a number that is incremented by 1 for each new I frame. Same with P frames, audio, etc... The timer frames come in two flavors, beat clock (which occurs exactly every 0.095 seconds), and time stamp (which occurs exactly every 0.95 seconds). Going a level deeper into the MPEG data there are at least two more time stamps, one for when data is delivered and one for when it should be displayed. There are also more sequence counters. All these timers and sequence counters are expected to be correct - when they are not strange things happen.

As you can see, managing all this is non-trivial, to say the least.

Chris
 
Last edited:
Interesting I joined 3 mts files with your program and merged them as one file and it plays back in splashlite. How is it doing that?
Good question. A player that can cope with the time stamp discontinuity could still be playing the stream, but the joined stream is not compliant to the official mpeg transport stream specification. If splashlite plays it that's pure luck :)
 
MTS streams have embedded time and sequence codes at multiple levels. If you try to just append them to each other the results will be inconsistent time and sequence codes. Editors allow you to do this, but they replace all the timing and sequencing data in the process. It's actually a pretty complicated process. You basically have to completely decode the streams and re-encode them to do it properly.
No (re)encoding needs to be performed. A program could handle this just by demuxing into elementary streams and remuxing them with continuous time stamp information, but you need to ensure that the files start and end with an I(DR)-frame.

The file splitting that happens at the 4GB limit is a different issue - they are coherent streams that have the correct timing and sequencing data already in them - they just happen to be split into multiple files. When you stop recording and then restart, the timing and sequencing parameters are reset when the new clip starts and thus the clips can no longer simply be appended.
This is 100% correct.
 
True, the actual video coeffecients etc don't have to be re-encoded, so there wouldn't be a loss of quality or anything like that. But, the timer stamps inside of the elementary streams do need to be extracted and fixed. To do that you have to decode the video streams right down to to where you have the video data available too. With AVC that's non-trivial. It's not like straight MPEG where that information is available in the headers relatively unencoded, with AVC you have to decode and decompress that information (it's golomb encoded as is the actual video data). That means that when you have to put all this back together the memory locations for certain data can change. That's what I meant by having to re-encode. If your editor relies on these time stamps being correct you have a problem. I'm not saying it's not possible - just that it's a pretty substantial project to do it right.

Chris
 
Last edited:
I'm almost giving up.

I'm almost giving up.

i've now pretty much tried everything available on the net. TSmuxer had audio sync problems, multiavchcd software went into a loop, something called mts converter ( a few of them) also didn't work out - a lot them had a bit of audio syncing problems. The one that came close to being a success was MTS_filejoiner. I had joined 27 .mts files together and playing back every 2 or 3 clip would not display properly, it then moved on and played the next clip properly with no audio syncing problems.

Has anyone been successful with joining your .mts files into one file without any problems for playback?
 
Last edited:
I use the DOS Copy command
Copy /b 00000.mts+00001.mts C:\combine.mts
This is the only system I use. However, this is for clips that are split by the cam.
 
why not "join" the files nuts-to-butt in your NLE? shouldn't that play through? sorry if i'm missing the point entirely.
 
... and how to split them?

... and how to split them?

Don't want to hijack this thread, but my question is still related to the original question.
Does anybody know how to split GH1 mts file (select only a part of the file) without re-encoding it? It does not have to be frame-accurate, so it can start at I frame. Namely, sometimes I would like to show (post) only a part of the clip, since whole clip would be too long. For example, my clip is long 150 I-frames (about 75s) and I would like to show problems which appear between 25th and 35th I-frame. How to select only a part of the clip from 25th to about 35th I-frame without re-encoding it (so that others can, for example, also use GH13 StreamParser on that clip)?

I suppose that, as Chris already mentioned, it shouldn't be so easy, since video information has to be decoded and replaced by new time stamps. However, what would happen if we just leave unchanged time stamps?
 
crunchy, you can probably select frame to frame in your NLE's trimmer?...not sure if "trimmer" is the universal word, but in Sony Vegas it is. having a strange night man, so i'm sorry if i'm not making sense.
 
Back
Top