Audio sync drift, video laggs

I need help on this one. First how to test/debug where in the render chain this my error may be: kdenlive, melt, ffmpeg...?

My issue: a simple kdenlive project consisting of 1(or3) 'standard' 720x480mpeg2 video(s), wav 'master' audio (44100Hz), and a few image panel/inserts. The mpeg audio is muted and wav is synced to mpeg vid. So in kdenlive the wav is fully synced to the vid (monitor) for the whole project.
When rendered to NTSC DVD, the video begins to lagg the audio 1-2 sec after 30m. This is the same for FFV1 lossless, and most others I have tried. I did hit on one file render Xvid4{acodec=libmp3lame ab=128k ar=44100 vcodec=libxvid minrate=0 vb=8000k aspect=@16/9 mbd=2 trellis=1 mv4=1 pass=1 threads=4 real_time=-1} that seemed to worked, the audio and video stayed in sync, but had some strong interlacing effects.

**Update: render to libdv seems to work, without this issue of sync drift, only tested on small 15m junk, file is big!

Is this an audio sample issue, where 44100 into 48000 is causing some frame sync problem in the render chain?
What can I try to see where the problem may lay? I am suspecting it may be ffmpeg, but need ideas on testing this.
This is a showstopper for me (pun partially intended) and will even try a many hop workaround (thru some lossless renders...).

Thanks for any help, cheers, H.

Version info (openSuSE.x86_64):
Kdenlive 0.9.6
libmlt5-0.8.8
ffmpeg-1.0.6

Forums:

This sounds the same as this http://www.kdenlive.org/forum/moved-audio-after-rendering

You two maybe should get together and generate a bug report in mantis

It seems similar, and could be coming from same underlying issue. I am also looking for ways to flush where this error is coming from, and getting at user testing/console level (verbose, etc) output. I would like to narrow it down some before I file a general/vague bug report. cheers, H.

Well I may have narrowed it down some. After a further fustrated round of testing, I went and upsampled the wav audio from 44100Hz to 48000Hz with ffmpeg and used this 48kHz version in place of the 44100Hz in kdenlive and rendered a zone/chunk to mpeg2. No drift of AV sync.

So I will do a full render of my project to really flush this out, but it may be that if the render sample rate is to be (-ar) 48000, then an input of 44100 is not being properly transcoded/upsampled by MELT through ffmpeg. So this may be the work around if anybody else is having this annoying issue.

I have not been able to reproduce this. I used a DV/DVD NTSC project setting, MPEG-2 Video, and 44.1 Khz WAV generated separately from the video. Then, I rendered over one hour to DVD NTSC and checked the output in VLC. But, I am not using the same versions as you; I am using git head of ffmpeg, MLT, and kdenlive. Did you use a DV/DVD NTSC project setting (or let it be selected when adding the video clip)?

I do not think you are really rendering with libdv unless you are manually running melt at the command line with the proper invocation for libdv. When you choose a DV render profile in Kdenlive, it is still using the ffmpeg-based MLT avformat consumer and its superior quality DV encoder. However, DV is quite unique in how the audio for each video frame is embedded within the frame. This makes A/V sync in DV very hard to get wrong - both for writing and reading. If DV works good, then you can transcode that to DVD.

I am running another render at the moment where I am not using a DV/DVD NTSC project setting. That forces makes Kdenlive put melt into a little different mode. Will see how that turns out.

Maybe also try one of the daily build "app bundles" here:
http://kdenlive.org/download-development

Make sure you launch kdenlive using the start-kdenlive script it supplies.

I've also had problems with svn builds recently mixing the two audio sample rates in a project, upsampling to 48000 and removing any 44000 had fixed it for me too previously. Encoding to h264.

Thanks for testing.
I do have the project(s) set as DV/DVD Widescreen NTSC, and each project where I see this issue (have not test otherwise) is with 1 wav audio (44100) clip and 2 or more mpeg2 video clips. Could it be the multiple video clips back to back prompting this? Each mpeg2 video has audio(48000), but is split and muted, where I am using another recorded source wav(44100) across all the video clips.

As for libdv, I not sure, here is PARAMETERS="-pid:11971 in=0 out=27068 $MELT dv_ntsc_wide libdv - $SOURCE $TARGET threads=4 real_time=-1" in the script that I ran. All the others have avformat, so not sure if kdenlive or melt use ffmpeg regardless.

After upsampling the wav audio to 48kHz and rendering, my projects are in AV sync, so im getting the work done. When I can I will test the daily build with the 44100 wav project. (A opensuse build service repo would be highly appreciated, or just a .spec I can use/tweak)

A bug (http://www.kdenlive.org/mantis/view.php?id=2694) seems to be similar, and have added some comments there (more of a back reference). Should I start a new bug report for this?

I got to here through that bug. Let's not open a new one at this time.
Ah, I guess you are using libdv then. I was not aware there was an option to do use that in kdenlive even after I did a (filtered) code search on my kdenlive project for libdv. Anyways, thanks for the additional info about the project setup. I was only using one video clip and not splitting audio/video. I will try again.

Pages