long-term A/V sync (mlt problem?)

Hey guys,

I am probably bringing up a very old and often discussed topic again but I just gotta ask as it's driving me crazy right now.

So I am working with some videos that range from 13 to 20 minutes right now. However I am experiencing a problem:
The rendered video looses A/V sync after around 10 minutes. The Audio or Video seem to slowly "drift". So in the beginning of the rendered Video, everything is okay. But after around 10 minutes I begin to notice that video somehow seems to be a BIT slower than Audio. Still I am not sure wether Audio is rendered faster than it should or Video is slower.
I could not really measure it, but after 20 minutes Audio seems to be about 500ms ahead of the Video.

I am using kdenlive 0.9.2 and mlt 0.8.0.
The original footage uses x264 and raw sound.
I tried to export the rendered videos to all different formats, using various codecs and tested with different video players. Of course I made sure the kdenlive project uses the same FPS settings as the original footage. also to note that within kdenlive everythign is fine and totally in sync.
However this makes it just harder to correct this "drifting".

I guess this might have something to do with this particular spot of the mlt Roadmap:
"improve unlocked DV audio to prevent long-term A/V synchronization problems"

Still - not sure tho.

I am currently helping myself around by just rendering the whole project in 5-minute clips and splicing them back together using ffmpeg. At least I *hope* this'll help on the issue (still rendering so I cannot say).

Still even if it's helping, it does not really solve the overall issue. specifically when the video reaches the spliced point... I bet I'll be able to hear it.
And making these 5-minute clips is actually pretty annoying work.

Initially I thought I could possibly prevent this by just using the scissor tool, making cuts every 5 minutes. Nope - did not help.

So if someone has a hint to me on how I could solve this issue in an easier fashion - I would love to hear it. also I gladly try to provide more info if requested (you know... I would provide more if I knew what to provide).

Thanks in advance.

- Chris

Forums:

Have you tried multiplexing your video and audio stream outside of kdenlive with ffmpeg, mp4box or mkvmerge?

Hey,

Yes eventually this is how I solved the problem now after splicing clips together didn't work (i.e. was too noticable).

BUT:
Before muxing the Audio onto the Video I have to make the Audio precisely 0.065% slower so it'll keep matching the video. Dunno if 0.065 is the perfect timing but it works perfectly with a 17 minute project.

However I now think that the problem lies within the video. After slowing down the Audio it kept in sync and I could fix the ~500ms offset I had in the end of the Video.
Still I also noticed that the Audio track now reaches ~500ms into the credits. This is where I initally cut the Audio-track. So it seems the video was slowed down when rendering but still cut at the time I added in the credits (black screen with text).

So maybe the problem actually comes from my original video footage which is a 20FPS stream I captured from my Desktop via ffmpeg. I already set it down to 20FPS at recording with higher values was too much for my computer. I wonder wether ffmpeg still might drop a frame or two during recording... causing this issue.
But if that's the case I wonder why all is in sync (captured video, captured audio, additional audio) before and while editing - but messes up after rendering.