Here is a simple shell script that will use ffmpeg to convert mts files to mkv format using the h264 codec to compress them.

    #!/bin/sh
    #conversion parameters that seem to work best with my camera (panasonic lumix)
    #put the name of the file without the extension in the FILES variable.

    FILES="00000
           00001
           00002
           00003
           00004
           00005
           00006
           00007
           00008
           00009"

    for f in $FILES
    do
        echo "Processing $f.MTS"
        ffmpeg -i $f.MTS \
            -vcodec libx264 \
            -threads 0 \
            -vpre normal \
            -b 2000k \
            $f.mkv
    done

Replace 00000 - 00009 with the names of the movies that you want to convert to mkv format.