One problem with low-cost digital set-top boxes (STBs) that can record digital TV to external storage is that they invariably only support the FAT32 file system. That means the maximum file size you can get, even in theory, is only 4GB. If you’re capturing 1080i (1440×1080-pixel) video, it doesn’t take long to go through 4GB of storage – about half an hour. So what these boxes do is split the files into sub-2GB chunks. While the STBs are designed to play them back easily enough, converting them to another format is a bit of a pain when you have all of these chunks to deal with.
One DOS command
All digital TV in Australia is broadcast using the MPEG-2 video codec and the MPEG-Transport Stream file container. In other parts of the world, H.264 is now the commonly used codec. (At some point in the future, MPEG-2 may give way to MPEG-4 in Australia but it’s unlikely to be any time soon). That means that no matter what tricky file extension the STB uses, the file container is still only MPEG-TS. And because all MPEG-TS files are self-contained (that means they include the header information in each file), you can merge video files together with a single DOS command:
copy /b video1.trp+video1.001+video1.002 videofinal.mts
The command is a modification of the old DOS copy. The ‘/b’ switch tells it to copy as binary files rather than text and to join the three files linked by a “+” symbol and to save the three into a single file called “videofinal.mts”.
If the video files all have the same name and different numerical extensions such as ‘000’,’001’,’002’ and so on, you can use this shorter version.
copy /b video1.* videofinal.mts
The copy command is smart enough to copy files in numeric order in this instance.
Other file containers
While we’ve looked at this trick for MPEG-TS filetypes, what we haven’t said is that it’s actually usable on a number of file containers. Like MPEG-TS files, VOB and MPG file containers are also self-contained, which means you can join files together using this process. However, they shouldn’t just be random files. You should really only do this with files that were captured using the same device and capturing the same program.
As for audio files, while you can merge MP3 files using this method, the ID3 tag information will only include that of the first file, not any subsequent files. However, the resulting merged file will play fully in most media players.
Remember though – this method is just a straight copy. You can’t cheat and make the output file a different file type – it just won’t work. But for joining video chunks together, you’re not going to get a faster or simpler-to-use option than this.
And before you ask, no, it doesn’t work with AVI, FLV or MKV files and despite what you might read on the web, FLV files don’t correctly merge using this method. While the videos do indeed join, most video players can only see the first video, not subsequent videos. VLC and Media Player Classic had this trouble.
Merging other file formats
If you have video segments of other file types you want to merge together, convert each segment into an MTS file container using MPEG-2 or H.264 compression, then use the “copy /b” command to join them together. Once you’ve got them in a single file, convert it into whatever you want.
You’ll need to set the bitrate to as high as you can during the intermediate MTS step so as not to lose video quality but you could also try a dedicated video or audio merge tool such as MP4Box or mkvtoolnix (both of these can be found at www.videohelp.com).
The only thing that may cause some issues down the track using this one-line method is the fact that unless the files all came from the one single recording, the timestamp on the final merged file will likely be wrong. Instead of the timestamp equalling the runtime of all the segments, it may only equal that of the first segment.
Files formats joinable using COPY /B
Here’s a quick list of file types you can join together with the good old “copy /b” command:
- M2TS (Blu-ray)
- MP3 (audio)
- MPG (PC video)
- MTS (Blu-ray, digital TV)
- TP (digital TV)
- TS (digital TV)
- VOB (DVD)
Reports of this working on FLV, MKV and AVI files are exaggerated.