support MTS file format

Bug #695517 reported by Damon Lynch on 2010-12-29
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Rapid Photo Downloader
Damon Lynch

Bug Description

The MTS video format is used by Panasonic and Sony. Currently, neither kaa metadata or hachoir-metadata can extract any metadata from it. Therefore, it is ignored by Rapid Photo Downloader.

This is the folder structure used:

The clip info file may contain metadata.

Related branches

Damon Lynch (dlynch3) on 2010-12-29
Changed in rapid:
status: New → Confirmed
importance: Undecided → Wishlist
assignee: nobody → Damon Lynch (dlynch3)
kmtathome (kmtathome) wrote :

I would love to see this implemented.. My Sony Cybershot DSC-TX7 creates MTS files and currently I'm having to copy them off the media cards by hand. Thanks!

Damon Lynch (dlynch3) wrote :

The implementation of this feature depends on support in hachoir-metadata. A hachoir-metadata developer has started to work on this. It's far from easy, as the documentation for the format is not publicly available. But I hope we can have some good news soon.

After reading you last comment, Damon, I googled for "hachoir-metadata MTS" and this seems to be the relevant mailing list discussion: http://<email address hidden>/msg00503.html (just wanted to link to it from here in case others are interested in the details).

P.S.: Thank you a lot for RPD, it does make a difference!

hi, as i face the same problem, i wonder what information do you need to extract from the file to do an import? i just found which is able to extract this information of one of my files:

ExifTool Version Number : 8.50
File Name : 00000.MTS
Directory : .
File Size : 8.5 MB
File Modification Date/Time : 2011:06:05 14:12:27+02:00
File Permissions : rwxr-xr-x
File Type : M2TS
MIME Type : video/m2ts
Video Stream Type : H.264 Video
Audio Stream Type : A52/AC-3 Audio
Audio Bitrate : 192 kbps
Surround Mode : Not indicated
Audio Channels : 2
Date/Time Original : 2011:06:05 13:28:27+00:00
Make : Panasonic
Audio Sample Rate : 48000

would that be enough?

let me know, if there is a way, i can help!

kmtathome (kmtathome) wrote :

My apologies if this is off topic, but I suspect there are others out there waiting for support for MTS files in RPD.

After digging into exiftool some more, I found the following workaround until support for MTS files makes its way into Rapid Photo (via hachoir metadata of course). All I wanted to be able to do was to read the MTS files off from the media card, change the filename based on the creation date of the file, and to copy them to a directory hierarchy of my choosing. exiftool can actually do this pretty easily with a little trial and error. The hierarchy I use is:

Year/Month/Day/filename.MTS, where filename is YearMonthDay_HourMinuteSecond.MTS

So a typical file looks like this:


So with exiftool (version 8.61 in ubuntu 11.04), I can accomplish this with the following command:

exiftool -v1 -o . '-filename<DateTimeOriginal' -d ./%Y/%m/%d/%Y%m%d_%H%M%S.MTS -r -ext MTS /media/disk

This searches for all the MTS files on my media card (/media/disk) and copies them to the directory and file hierarchy defined by the -d flag. After these are imported, I run RPD against the media card again to pull off the JPG files.. A couple of links that were helpful to me:

Note that this does NOT preserve creation time from the original file, but given my file naming scheme it doesn't matter to me...

Maybe this can help someone else until the functionality is finished in the most excellent RPD....

THANK YOU for this perfect idea. this will do the trick until mts support will hopefully be implemented in rpd one day !

Damon Lynch (dlynch3) on 2011-09-26
Changed in rapid:
milestone: none → 0.4.3
Damon Lynch (dlynch3) wrote :

I am now working on this code in Rapid Photo Downloader. Can someone who has an MTS video file which is longer than one minute run this from the command line:

exiftool -j -duration video.mts

obviously you have to change the video.mts to be the name of your video file. Copy and paste the exact output back into this bug report, thanks.

kmtathome (kmtathome) wrote :

Awesome.. Here's the output from a rather large/long MTS file:

$ ls -l 20111013_055016.MTS
-rwxrwxrwx 1 root root 1005256704 2011-10-15 16:36 20111013_055016.MTS

$ exiftool -j -duration 20111013_055016.MTS
  "SourceFile": "20111013_055016.MTS",
  "Duration": "0:10:56"

Thanks. It looks like the output of exiftool varies based on the type of
file it's reading. Some values are strings, others are floats. And in this
case, it seems that if the duration is less than one minute, it says for
example "36 s".

kmtathome (kmtathome) wrote :

I noticed this too.. Turning off the string conversion (-n flag) doesn't have this issue. Could this be used instead?

$ exiftool -n -j -duration 20111013_055016.MTS
  "SourceFile": "20111013_055016.MTS",
  "Duration": 656.050481777778

$ exiftool -n -j -duration 20111013_060119.MTS
  "SourceFile": "20111013_060119.MTS",
  "Duration": 6.53604977777778

Damon Lynch (dlynch3) wrote :

Indeed it does, thanks. I didn't notice that before.

Damon Lynch (dlynch3) wrote :

I've written the code and pushed it to launchpad. Let me know if you want a tarball to test it out on your video files. I would definitely appreciate it if you did that, in case there are bugs.

Changed in rapid:
status: Confirmed → Fix Committed
kmtathome (kmtathome) wrote :

Would be happy to test it. Please send the tarballl..

Stian Jordet (stian-web) wrote :

I'm a bit slow, but I have tested now. And as expected it works perfectly :) Thanks a lot! :)

Damon Lynch (dlynch3) on 2012-01-08
Changed in rapid:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers