Saturday, May 7, 2011

A quick script for concatenating MTS files

A small script I wrote to fix some problematic video files. In this case the problems were due to the design of the video camera I was using. Basically after recording 2GB of data, the camera was dumping whatever data it had recorded into an mts file, and then starting a new recording. While all the camera data ended up being recorded, problems arose with the second file, as the keyframe information was in the wrong place, etc. Basically, whoever designed the camera (some team at Sony) were morons.

Here's a simple script I wrote to fix their incompetence. Usage is mtscat -o output_file file1.mts file2.mts ...
Essentially does the same thing as "cat file1 file2 file3... > output_file" except that for the second and subsequent files it skips over the first 192 bytes (the header for the MTS stream)

Script is linked below:
mtscat.py

No comments:

Post a Comment