iMovie and MTS

märts 18th, 2010 | Filed under Mac

A few times before I have imported my short clips from the Sony HDR-CX106 camcoder directly using iMovie camera import features. Now, that I had a bit longer videos on the camera, I got to thinking why it takes so long and how come it reports that 60 GB of my hard drive will fit only 1 hour or so full-quality video. It turns out that by importing, iMovie probably converts all the clips into HDV compliant format, thus MPEG2 and thus resulting in wasting my hard drive space.

What about AVCHD?

This was the question I asked myself and by googling around I found out that as of yet, iMovie does not directly support AVCHD format. But it does not have any problems with the H.264 encoded videostream in the file nor with AC-3 encoded audio stream.So – obvious solution was to repackage the file into another format using FFmpeg.

First up was ofcourse MP4, but as it turns out, AC-3 audio is not officially supported and iMovie refuses to import such a file. So I installed also libfaac to encode AAC, which is MP4’s default audio encoding and run:

Unfortunately this method was a bit slow, as it reencodes the whole audio stream, so as I was not limited to MP4 format and iMovie is more than happy with MOV files, I could instead just copy both streams into a MOV container:

Now I can just drag these files to iMovie and only have to wait for it to update thumbnails. And most important – disk usage is kept normal, not increased tenfold as with direct import.

Automated batch conversion

The above command can be turned into a script that takes output folder as argument and list of files as input:

NOTE: the script is written on a Mac and uses Growl to give feedback. If you don’t want/have them, just comment out all lines with growlnotify in them and you should be OK.

Automator service

I turned the above script into an Automator Action and that action in turn into a Finder Service, so that I can use it conveniently from the finder window.

Bot of them can be found at my Automator page.

Be Sociable, Share!
  1. swexican
    mai 18th, 2010 at 15:57
    Reply | Quote | #1


    First of all thanks for sharing this helpful info. I might be on the right track but I still have som issues when doing the conversion.

    My output video doesn’t play any sound, even if MediaInfo sais it does have a AC3 sound stream. Also even if the frame rate looks right I get some really strange color flickering effects (like colors from one tone to another every second). I tried to play this both with VLC and Quicktime and I get the same problem. If it just copies the video stream, shouldn’t it just play the same regardless of container?

    May I ask if you get a clean copy of the source or do you see any differences in color or frame rate? Does ffmpeg output any warnings att all when you do this?

    My source camera is a Panasonic Lumix DMC-TS1S and I do the conversion with latest stable of FFmpeg on Linux….

    Thanks for you time 🙂

  2. Laas
    mai 19th, 2010 at 17:51
    Reply | Quote | #2

    Hi Swex,

    I get my video and audio correctly w/o any flickering. Have you tested these files on different computer (preferably different OS)?
    Maybe something has gone awry with the decoding libs.

    Does VLC play the original file before converting?

    And did you notice that MP4 standard does not specify AC-3 as an allowed audio stream. You have to reencode it to e.g. AAC.


  3. Min
    mai 23rd, 2010 at 14:58
    Reply | Quote | #3

    I think this is probably something unique to Lumix cameras. I also have the same color flickering problem. I tried first going both mp4 (reencoding audio) and I saw the color flicker. When I just copied both stream into the .mov, the same color flickr was there. However, I used Handbrake to re-encode both audio/video and the result is perfect.

    Would you mind taking a look at one of my .mts file to see what is so special about it?

  4. Laas
    mai 24th, 2010 at 08:44
    Reply | Quote | #4

    Hi Min,

    I certainly can have a look, though I do not call myself an expert in this regard.
    If you upload your files somewhere, mail me a link. (Contacts can be found above).

  5. Motts
    jaan. 9th, 2011 at 22:35
    Reply | Quote | #5

    Hiya Laas, I have been trying to use your automator action in my workflow, but I keep getting the “Check the actionʼs properties and try again” error.

    I know that ffmpeg has been installed properly, because I can still use
    “ffmpeg -i 0001.MTS -vcodec copy -acodec copy”
    from the terminal and it converts just fine.

    any advice?

    workflow screenshot:

  6. Laas
    jaan. 10th, 2011 at 09:57
    Reply | Quote | #6

    Hi Matthew,

    Maybe the workflow can not find ffmpeg on the PATH. Maybe you could specify the full binary path in the override field?

    If this does not help, I can look more into it.


  7. Motts
    jaan. 11th, 2011 at 21:41
    Reply | Quote | #7

    Awesome that worked! Thanks for sharing dude! :mrgreen:

  8. Simon
    juuli 14th, 2012 at 16:37
    Reply | Quote | #8

    Fantastic – thanks. Can I suggest that you add some more search engine terms in your blog post and title as it took ages to find this until I included ffmpeg in my mts to mov search.