Transcoding

CLI >
Due to the "Frozen frames" problem after encoding with Kdenlive (view.php?id=2659), I went through some experiments to try to make a smooth film...

I experimented with transcoding mts movie files to DNxHD with Kdenlive, and using the transcoded .mov files for editing and rendering to mpeg2, mp4, vob etc. (and you need to make a shortcut key for Transcode or find it on the File menu)

I tried a short project and got some disappointing results, along with an extra 10Gb of mkv files and suffocating RAM.  The video quality was not like the AVCHD quality, and had some glitches.

2nd, I Remuxed the mts movie files to MKV, and MPEG-2 PS/VOB and then encoded the film, but the results were jumpy with one and with slight stops on every clip join as well as some slow motion with the other.

3rd, I re-encoded the MTS files to various high-Q formats using ffmpeg to do this with a script:
mpeg2
#!/bin/bash
for file in *.MTS; do ffmpeg -i $file -vcodec mpeg2video -b 85000k -threads 2 $file.mpg;done

where mpeg2video is the codec, the k value is bits/sec (i.e. 85Mbps here) and the -threads flag tells ffmpeg to encode using more cpu cores (so it depends on your cpu whether it's dual core, quad core etc) but leaving it out will set to automatic.

I made the script in home dir, named "convert.sh", chmod +x, and made a Thunar custom action with the name "Convert MTS",  command /home/username/convert.sh %F and Appearance conditions set to  *.MTS;*.mts and check video files.  So I just click on an MTS file and hit Convert MTS and all files in the dir are converted.  Can easily make a custom action for any particular video format to encode to.

the resulting file is quite good quality (and you can go over 100Mbps but threshhold seems to be around 65-80M) and reasonable x4 file size, but it's not lossless, and it's another compressed video format that a video edito has to decompress and recompress, losing quality.
... but the rendered result in Kdenlive (say, to 18Mb mpeg2) is blocky, poor Q, when looked at close-up. So still not an acceptable solution!

lossless mpeg2 using intra-coded frames (makes files 13-20x orig. file size), use
for file in *.MTS; do ffmpeg -i $file -vcodec mpeg2video -qscale 1 -qmin 1 -intra -an $file.m2v;done

rendering result: smooth joins, high quality

DNxHD (makes files 17x orig. file size), use
for file in *.MTS; do ffmpeg -i $file -vcodec dnxhd -b 120M -an $file.mov;done

(got from superuser answers http://superuser.com/...)

M2TS (mpeg2 transport stream) -which the bundled Panasonic software always converted MTS into when capturing from the camera.  
The files produced are just over 3x the orig. file size, and the best thing is, Kdenlive copes really well with them AND the rendered movie is clean and high Q.
M2ts is 1440-1080 but the pixels are not square like AVCHD, but are 1.33 ratio, so the picture remains the same aspect ratio as the MTS 1920-1080.
When rendering the m2ts into mpeg2, it will come back to 1920-1080, (use the HD 1080p 50fps profile in Kdenlive to maintain 50fps).

script line:
for file in *.MTS; do ffmpeg -i $file -acodec mp2 -f mpegts -vcodec mpeg2video -s 1440x1080 -vb 45000k -g 12 -trellis 1 $file.m2ts;done

change the k value to suite your quality needs. 85Mb is better.

FROM M2TS, ENCODE TO H264 OR WEBM CODEC FOR *FAIR* RESULTS -ENCODING TO MPEG2 GIVES BAD QUALITY LOSS !
But encoding the 1440x1080 M2ts to HDV 1440 50i gives probably the best result and fastest encoding.

Attempt to Remux to MKV using Mkvmerge!
Mkvmerge GUI is an app for muxing video into a matroska container -worth looking at, from here http://www.bunkus.org/videotools/...
the guide, here ..mkvmerge.html http://linux.die.net/man/1/mkvmerge

Here's a batch script to remux all MTS files in a directory into a matroska container (.mkv).  I put this in a Thunar custom action and just right-click in the directory. #!/bin/bash
for file in *.MTS; do mkvmerge $file -o $file.mkv;done

once the AVCHD files are remuxed into a mkv container it seems that ffmpeg is able to read/decompress the files without making frozen frames at start/end of the clips in a Kdenlive project.  So the results are flawless, smooth, and of course there's no Q loss like you get when encoding to a lossy intermediate video format and then encoding a second time to the finished film.  Smooth at clip joins, but so far jittery all through, from frame to frame!

The Simple Solution!
Thanks to Norm2 reporting this on the Mantis Bug Tracker bug report.  All we need to do is to overlap every clip at the end i.e. move up each next clip to cover the end of the previous clip by 3-4 frames.  To do this make sure the "Overwrite" mode is selected with the button at bottom below the tracks.