Project plays with A/V in sync in Kdenlive, rendered version goes out of sync

At the end of my rope - I've edited and effected a 1:28 minute concert film, but can't get it out of kdenlive.

The source is footage from three cameras, two encoded to DV AVI files and one in it's native mp4. Since it's a concert, I've alinged all the video clips with the best audio track and made cuts to see the angles I want. I can play without flaw in kdenlive.

The problem arises when I render. I loose audio sync, but differently depending on the export format. I realize that some effects may be caused by players rather than the encoded file, so I tested each with both GMplayer and VLC. Results:

Destination: DVD>NTSC 4:3 VOB VLC Result: Loses sync at 33:18 on a particular cut;shots from only one track are out of sync. GMPlayer result:Same

Destination: File Rendering>MPEG-2 VLC Result: Loses sync at 33:18 on a particular cut;shots from only one track are out of sync. GMPlayer result:Same

Destination: File Rendering>MPEG I-Frame Only + MP2 VLC Result: Loses sync at 33:18 on a particular cut;shots from only one track are out of sync. GMPlayer result:Same

Destination: File Rendering>AVI DV>DV NTSC 4:3 VLC Result: Audio in bursts about once every 5 seconds. GMPlayer result:No audio

Destination: File Rendering>Raw DV>DV NTSC 4:3 VLC Result: Audio Drastically out of sync from the start. GMPlayer result:No audio

Destination: Lossless/HQ>HuffYUV + PCM VLC Result: No audio. GMPlayer result:Audio Drastically out of sync from the start

My Project Profile is DV/DVD NTSC

Kdenlive Version
Using KDE Development Platform 4.8.5 (4.8.5)

Running on Ubuntu 12.04.

I will add any detail as needed; without knowing if there's a clue in what I've posted so far, I don't know how best to proceed.

Thanks in advance for any clues.


If I had this issue I think I'd start by encoding out the video without sound to one of the lossless codecs, import it back in to a copy of the same project, mute the existing video track containing the vobs an mp4, what codec is inside it btw, interlaced h264, the issue could be right there.

Then retime the audio track where needed to the lossless import and encode out.

I'll give the export/re-import a go, thanks - I hadn't thought of that.

I made a mistake on the codec of one of my source clips. It's MPEG-2 with AAC Stereo Audio, not MPEG-4. The other two are DV video with PCM audio in AVI containers.

Tried exporting to HuffYUV with no audio, reimported to project.

I can sync the HuffYUV track with the audio track, but at 33:18 it goes out again, just like renderings did. Once again, only the clips on a single track are out of sync, so about half of my HuffYUV track is in sync past 33:18, the other half - the part that was video track 2 before I rendered - is out.

The only difference is that it now looks out of sync in Kdenlive. I suppose it's a more correct representation of what renders, but it doesn't help me complete my project.

Forgot to mention, did you split your audio from the source video clips? Also an alternative there's a extract audio to wav option you could also try that syncing wavs to huffy.

Which version of mlt do you use? For the last nearly year I had AV out of sync issue, until Mlt 0.8.6 solved all of those problem for me, and we we have 0.8.8.

I'd missed the fact you're on kdenlive, easy to make wrong assumption that everyone on Ubuntu is using sunabs repo's. OP best to update kdenlive & MLT to latest versions via sunabs PPA whether that be 'stable' or git PPA.

Good catch Vylaern. :-)

> Good catch Vylaern. :-)

So this is why I recommend in future release of Kdenlive to have such tool somewhere in the menu, to generate small text report about kdenlive and most important parts, so will be much easier to see before any answer what's wrong. Everyone could copy and paste it into eg. forum or buglist. Now kdenlive can use ffmpeg or libav, in many distribution available ffmpeg is now quite old (in compare to libav), so maybe the same version of kdenlive may behave in differnt way. Not everyone knows which version of which sub-packages kdenlive use, and in this way will be generated automatically.

Bellow eg. file

kdenlive 0.9.4
mlt 0.8.8
ffmpeg 0.10.6
libav -----
frei0r-plugins 1.3

But anyway, it might be some kind of bug in kdenlive.

I have problem with few effects (eg. Vertigo or denoise) which works fine in Kdenlive in Project Monitor, but rendering stops after 1 sec. It means, the effect works (I can see it), but doesn't work for some reason during rendering.

Found the problem, and it wasn't at all what I thought.

I asked for help figuring out why the render went out of sync. Turns out that the render was accurate, but the playback monitor isn't. The error was delaying audio just enough for it to look like I had good sync in the project monitor - on most playback attempts. The sync actually varies slightly on my system depending upon where in the timeline I start playback relative to the point of first apparent sync loss, how many tracks are layered, and effect density.

Once I began to susepect the playback monitory, I re-synced the last hour of the project using audio-only - playing the video clips with embedded audio and the master audio track concurrently, and shifting the clip until I got rid of any echo. I now have a happily working DVD.

My takeaway is that my version of KKDenlive on my system has slightly unreliable sync during timeline playback - less that 10 frames out,and hard to notice.

I don't know if that knowlege helps anyone else.

Thanks, everyone, for posting your suggestions.