rendering dilemma

I'm posting just to c if any one can give me some better idea than what I've been trying so far

For some reason, rendering AVCHD 1920-1080 directly with Kdenlive gives bad results as something along the way sees many end/start frames the same or frozen.

Transcoding to other formats with Kdenlive doesn't give good render video quality for me, such as DNxHD.

So I reencode the MTS files to M2ts with ffmpeg -result: no more frozen frames after render. The rendered movie is smooth where clips are joined.

However, the rendered quality (mpeg2 12Mb) is not very pleasing -has blocky appearance close-up, and it's worse than direct MTS to mpeg2 12Mb rendering. I find it strange cos the m2ts is good quality, @ 40Mb.

I've tried rendering to mp4 and h264 formats, but no better.

How can I get a better render from the m2ts? for example, rendering to DVD PAL 16:9 VOB there is no blocky effect, just poorer Q at 8Mb.
I noticed that in that render profile there are the following extra flags: bufsize=1835008 packetsize=2048 muxrate=10080000
are any of these helping the VOB output to be smoother/not blocky?

grateful for any ideas

MLT 0.8.0
ffmpeg 0.11.1
Kdenlive 0.9.2
debian wheezy


If you use Kdenlive to convert to m2t (mpeg 2 video) it changes the resolution to 1440 x 1080, so I would have thought ffmpeg did the same. Not at all sure, so check the size.

I guess its just the trade-off with mpeg2 compression gotta have Q loss

A couple of months ago I decided to check out the software bundled with my camera for converting the mts clips (Windows of course). That converted then to m2ts @ 1920 x 1080 but the quality was real crap.

In kdenlive, I can render sections of a clip to avi, pass it through stabilisation software and render it again in a project and it still looks 100% better than what the Windows software offered me.

I still have the double frames at the start and sometimes at the end but although it's annoying, it's quite easy to get by the problem.

m2ts is (I think) always 1440 by 1080 because the pixels are not square as mts/mpeg2 etc, but they are 1.33 ratio and so less pix but same aspect as what it came from

how to get round the problem?.. if I take the time to lop off areas at start/end of clips the rendering of the MTS still makes judders/stops in the new movie.

yeh, I followed the cue from the bundled software I used a year ago, convert to m2ts, then edit movies. of course there was little hope for getting anything from the software that's quality,

but with ffmpeg the m2ts = my mts quality. I think it was ubuntu where I had better luck with MTS rendering, but I'm not going back to it now!

Where you say " MTS still makes judders/stops in the new movie.", do you mean it is still the beginning or ends?

What are your AVCHD files from? Are they interlaced? ffmpeg/libav has had issues with decoding interlaced AVCHD. Do you have a native file as a sample?

In the Kdenlive Config MLT Processing threads is it still set to 1? Multithreaded decoding with ffmpeg/libav can cause issues with certain codecs.

I'd not reencode unless as a last resort and certainly not to mpeg2 or DV better to go to ffv1 or similar lossless codec. Have you tried remuxing them with ffmpeg, libav or mkvmergeGUI into a matroska container?

A sample file would be useful.

Try rendering using the webm codec. I have had a lot of good luck with this format and to be honest, I think it is probably the best format to render to.

I usually render it to about 600 if I am just transfering it youtube which works beautifully. The size is pretty small to plus you can drag this format into firefox or chromium and paly it --COOL!

Here is a sample of a simple webm to youtube I did recently:

Hope this helps.

thanks for the advice

1. M2TS:I've just found that encoding with h264 gives good quality from the m2ts -but it takes time on my dual core

webm also takes a LONG time from m2ts but also good Q -FFVP8 never heard of it! but handbrake is ok with it.

2. MTS: single thread attempt, got stop/pause at start of each clip after rendered, both mpeg2 and h264

but webm does it with good Q and no pauses, smaller file size as stated by hounddog, very lengthy encode
-but it makes black-outs at the end of clips!

3. REMUX to lossless- I made use of the remuxing in Kdenlive, and failed to get smooth joins still. But haven't tried remuxing outside Kdenlive with ffmpeg... will look at mkvmergeGUI this week

MTS sample here

I put that clip into a project and butted it up on the end of another .MTS clip. When playing, the clip change over worked fine but at the end of your clip you have 6 frames all the same. When dragging the clip in those 6 frames it played ok at either end of the other .MTS clip.

Yes, it's interlaced AVCHD, ffmpeg and libav have problems with interlaced. Maybe remuxing to mkv might help but not solve it.


Just tried the sample file and see no problem with a 1080i 25fps project leaving the source as interlaced, creating an i terlaced proxy like DV or mpeg2 for smooth playback in kdenlive, butting four copies of the clip together and rendering to interlaced h264.

But did see problems trying to do a 1080p project and trying to deinterlace.

So 1080i should work fine and set media player like VLC to deinterlace, Yadif being good but more demanding on my hardware for deinterlacing HD, gave non realtime playback, using a cheaper deinterlace method like blend gave smooth playback but lower quality. So be sure that the playback problem is not media player related making it look like a bad render out of kdenlive.

Hi yellow,

This is most strange. If I load that clip into my default project settings of 1080i 25fps, the last six frames are all the same. So what's happening here?

If I open Clip Properties, it says the Frame Rate is 50 fps and scanning is Interlaced.

I thought I had better point out that my only problem has been the duplicate frames at the beginning and end of a clip. Someone mentioned in a different thread that there is a five frame problem and I believe he is right.

My workround is not trying to cut these frames off because that isn't very successful (another story), just two cuts somewhere in the clip and change timelines. A lot quicker than remuxing.

Of course, there isn't a problem at all if you're using transitions.

Just carried out my alterations to the offending clips in three Projects, re-rendered and all look great.

Happy again.

>-but it makes black-outs at the end of clips!
>but at the end of your clip you have 6 frames all the same.

This is probably because of the MTS/M2TS clips from the camera is missing some video frames at the end of the clip! The audio is sometimes longer in MTS clips.

The solution (at least for me) is to cut 4 frames from the end of every clip. Maybe some camera models leave up to 6 frames without video. It's very time consuming though to cut off the frames from each clip if you have 200 clips in a project... That's why I've suggested to add a feature to kdenlive for multi-clip-cut-off (another thread in this forums).

well, I tried once more remuxing the mts to mkv (in Kdenlive) and its a nice fast process..
then rendered some clips together
what I get is "blinks" at each clip start -though on one test not every clip had this. its a fast black-out

that gui for mkvmerge can't batch remux, its one-by-one and so a pain for hundreds of clips.

hi, normcross, I'll try again, perhaps I missed something but the encode seemed fine.

orbspider, mkvmerge can be CLI and a simple script made to batch convert, but the question is if you remux and test a file with mkvmerge does it help? :-) No point looking at batch remuxing with mkvmerge if it doesn't. :-)


normcross, yes you're correct frames do repeat but it appears to be a decompressing error with ffmpeg/libav as suggested earlier rather than a problem with the source, using DGAVCDec + Wine, a free MS Windows tool from Donald Graft, stepping through shows no duplicated frames.

Hi yellow, I totally agree with you that this is not the fault of the source files. I remember this happening sometime ago, so I just checked. Back in April I did some small alterations to an old Project, this is when I first noticed a problem when using leading frames of a clip.

Although these frames are there, they are not being treated as part of your clip. I suppose it's a bit like a mirage, we can see them but they are not really there, well, they are, but I'll try to explain.

If you zoom the timeline to frame level and cut off the two first copied frames, then step through the next two frames of the clip, they are still static and appear to be the same as the cut off frames. Cut them off again and step through the clip, they are still there, but stepping to the third frame there is a huge jump. In this instance, I have actually cut out four frames after the two rogue frames.

Bet that didn't make any sense at all :-)

It's not a great problem, once you know they are there. So using clips close to the leading and tailing frames need just a little bit of special attention on the timeline.

Just did my very last little test:-

Placed a 12 sec .MTS clip on the timeline and selected a six second zone from the centre.
Rendered to XVid4 and to H.264

XVid4 had 5 static frame at the start and 2 at the end.

H.264 had 2 static frames at the start and 5 at the end.

Oh, and audio seems to start from the very beginning, so XVid4 is more out of sync than H.264.

Also tried it with a build script version of Kdenlive from a month ago. Just used H.264 and it had 5 static frames both ends. Oooops.

But I'm still alive and well in mpeg hell. (Oh dear, assumptions again) :-)

tested mkvmerge gui and with two tests the clips join up perfectly, no pauses or studder.

question is how to batch remux a dir of files -I'll be well happy when I find it out cos remux in the gui was simple n fast

yellow, may I have that batch script please?!

Actually I got one, which I made up, and it works... so will do testing
for file in *.MTS; do mkvmerge $file -o $file.mkv;done

(execute that with a Thunar custom action right-click or other file browser script, i.e. /home/username/ %F)

---after testing
-a project with 19 clips (MTS remuxed .mkv), most of them cut up to shorten the rendering
result: absolutely FLAWLESS, instant progress of next clips, and excellent quality achieved with h264 codec.
[edit: so I thought at first]

so, that is [almost] the winner for me. thanks yellow, you have saved me messing around with re-encoding and achieving no quality.
now I can get on with the back-log and keep shooting!

And I hope that this answer will help others with AVCHD/ffmpeg "frame-freeze" problems.

nb. I installed mkvtoolnix to use mkvmerge, from here

orbspider, that's great, pleased to have helped. :-)

it's not quite over!
I discovered that the rendered projects are a little jittery from frame to frame, especially noticed with motion
but my kdenlive/mlt is only latest stable not from git -which always has fatal error time-out

can someone try remuxing the clip I uploaded and put through kdenlive @ hd 1080 25i to whatever and see if there's jitter/slow motion, cheers

if likewise jittery then the remuxed files are not being handled well either

I've had problems joining MTS clips without pauses between the clips. I've managed to join my clips, but they act different when I play them on different platforms. And I didn't manage to get the subtitles in the "baked" final large clip. Also I had problems with the audio/video sync (because some MTS clips has 1-4 frames with no video at the end and this added up on each clip so after 10 clips the audio could be 40 frames before the video).

The best I found was a Windows program called "FinalMate". But it wasn't perfect, I even got contact with their support and they made special versions for me to be able to join the MTS clips without pauses, but it failed...

Play in Windows Media Player in Win7: Good, no pauses, good pic (a little to much color/contrast though for my taste), got subtitles.

Play on my TviX 6500 media player: Average, some pauses, good pic, no subtitles

Play in Linux/VLC: Average, some pauses, good pic, got subtitles but at work place in the frame

So, I gave up. I think the only way is to re-encode the MTS clips. But I'd be glad if I'm wrong and there was a way to perfectly merge the MTS clips! I'll take a look at mkvmerge.

I've never had audio-sync issues

I checked a rendered file from July last year (direct from MTS) and there are subtle clip change pauses
so I've had this problem a long while.
what annoyed me was the dvd's that i gave people had these pauses all the way through (but not 100% of clips)
I will probably have to put up with it!

unless I can figure out a mkvmerge command line option that fixes remuxed files to render properly

...I've tried nearly all of them and no difference, still got stuttering play after render

The video below was made recently from .MTS clips. Sections of most clips were rendered to .avi in Kdenlive for stabilising in VirtualDub, that was all.When rendered, nearly the whole video stuttered at clip change, so I had to just redo the Project, but with changes to how the clips changed over. If you watch it, you can actually see one that I missed. Couldn't be bothered to do it again.

If I edit the MTS in kdenlive and cut off 4 frames of each clip I don't have any stuttering, but it's a time consuming and boring job... Plus the video gets recompressed = not optimal. I have to double the bitrate to get the same quality as the original MTS clips when using MP4 (original = 9Mbit/s and I have to use about 18Mbit/s in MPEG-4).

btw, nice video normcross!

Hi OpenThinking, Thanks. I don't think I explained very well. It does not matter if you convert the .MTS to whatever, or in my case render out a small selected section of an .MTS clip, new static frames then appear on the freshly rendered, lets say, .avi clip.

Cutting off the frames is not always successful. My, I hope, temporary workaround is simple. If I want to use the leading edge of the clip, I must overlap it by the preceding clip by at least a couple of frames. Not cut it. The tail end of the clip works fine by just dragging the clip back by five or six frames.

It's a nuisance, but it works for me.

My .MTS clips used to work perfectly!! Now they don't. So, in conclusion, this must now be a software problem. Here's hoping.

what we need is a survey to find out how many persons use AVCHD with kdenlive...
of those, currently, how many get paused frames at clip joins after rendering
and how many have no problems whatever (except for crashes!)

and do the developers know what causes this problem?

otherwise we are just wondering if we are the few with a nuts app/system/machine while every one else is enjoying bliss!

@norm, I didn't notice a glitch, nice shoot!

Sorry, wrong thread.

@ orbspider, thanks for that!

Yes, it would be nice if anyone using AVCHD clips and NOT having this problem would come on here and say so, please, anyone?

I haven't had much luck with editing AVCHD -- current ffmpeg/mlt (sunab's builds for Ubuntu 12.04) is quite a bit better than the previous version I was using (sunab on Ubuntu 10.04), but still has trouble seeking reliably. I transcode to DV, since I'm only doing standard def. work.