Reply to topic

Audio Out of Sync on Render

trmills
Registered Member
Posts
4
Karma
0

Audio Out of Sync on Render

Tue Feb 27, 2018 3:49 am
Hi all,

I'm new to the forum, but have been enjoying Kdenlive for a couple years. I noticed recently some videos were rendered where the audio gets progressively out of sync over the length of the video. I've seen a few posts about it, but no definitive answers.

I was running in Windows 10 (Kdenlive v. 17.08) when I noticed this problem. Occurred on all longer videos (>1hr). I'm converting VHS to DVD and using Kdenlive to simply trim, fade, etc. Audio and Video are synced fine in the preview, but after rendering they drift over the course of the video until it looks like a bad foreign voice dub by the end of the video. I did a clean install to 17.12 and FFMPEG 3.4.1, but no improvement.

I also tried opening the file saved in Windows in Ubuntu 16 via Virtual Box (also Kdenlive 17.12) and re-rendering but same problem. I have a fresh project started in Ubuntu rendering at the moment. I'll update with the outcome. UPDATE: Project rendered without any offset problems in Ubuntu, so maybe this is a Windows only issue for Kdenlive.

Any ideas? I love kdenlive, but this bug renders it unusable for me. Thanks!

Last edited by trmills on Fri Mar 02, 2018 2:17 am, edited 1 time in total.
capslock
Registered Member
Posts
698
Karma
4
OS

Re: Audio Out of Sync on Render

Tue Feb 27, 2018 9:06 am
What source format is your audio? If it is mp3 with variable bitrate, you could try to change it to flac or wav.
trmills
Registered Member
Posts
4
Karma
0

Re: Audio Out of Sync on Render

Fri Mar 02, 2018 2:11 am
Audio source is in the original video track (comes in as mpeg2, I clip it, export it as mpeg4). Is there anything I can do with that? I could try splitting it out and offsetting it (I saw a youtube video that promoted that workaround) but that adds quite a bit of unnecessary effort.
trmills
Registered Member
Posts
4
Karma
0

Re: Audio Out of Sync on Render

Fri Mar 02, 2018 2:44 am
One other strange thing I've noticed is that if I take a rendered clip that is out of sync, but then import it back into kdenlive, Kdenlive plays it properly even though other video software and even authored DVDs play out of sync.

This sounds confusing, so to give an example: I edit a video and render the file as Video1.mp4 with Kdenlive. When I play it in VLC the audio is out of sync. If I render it into a DVD with DVD styler, it is still out of sync. If I import Video1.mp4 back into a new file in Kdenlive as the source clip, when I play it in the preview pane in Kdenlive, it plays properly (everything is in sync). I'm testing now whether it will play properly after it renders.
capslock
Registered Member
Posts
698
Karma
4
OS

Re: Audio Out of Sync on Render

Fri Mar 02, 2018 7:57 am
Please post the result of

ffprobe <oneofyourinputfiles>

Then we can see how audio is encoded in the container that holds audio and video. I am on the road the next days and can reply on monday, so if no other joins the thread, please be patient. :-)
trmills
Registered Member
Posts
4
Karma
0

Re: Audio Out of Sync on Render

Thu Mar 15, 2018 12:21 am
Sorry, I was away recently too. Not sure if I got what you wanted, but I generated a script instead of rendering with Kdenlive and then ran the ffprobe command. Definitely some errors in there:

:~$ ffprobe test.sh.mlt
ffprobe version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
WARNING: library configuration mismatch
avcodec configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-version3 --disable-doc --disable-programs --disable-avdevice --disable-avfilter --disable-avformat --disable-avresample --disable-postproc --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libvo_aacenc --enable-libvo_amrwbenc
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
test.sh.mlt: Invalid data found when processing input
capslock
Registered Member
Posts
698
Karma
4
OS

Re: Audio Out of Sync on Render

Thu Mar 15, 2018 7:37 am
Oh, you did more work than needed. I just wanted you to post the output of

ffprobe <one of your input videofiles of the project>

But some posts above you wrote that audio is mpg2 and I assume it is mpg2 layer III which is known as mp3.

I guess audio is mp3 with variable bitrate and causing the drift. You can check this by rendering a minute of you project and check how long the drift is in there.

You now have (at least) two choices that should work (cannot try the workarounds or commands in the moment)
1. Render out audio, load into audacity (or similar tool), stretch it to the exact length of the video, export as wav or flac, import that audiofile into your kdenlive project, place it on a fresh audio track, mute all other audio tracks and render.

2. For each single clip do
ffmpeg -i <clip_filename> -vn -acodec flac <clip_filename.flac>
ffmpeg -i <clip_filename> -i <clip_filename.flac> -c copy -map 0:v:0 -map 1:a:0 <clip_filename.mkv>

The first command gets the audio from the clip and saves it as lossless flac (hopefully in the desired length).
The second command copies the lossless flac and the original video streams into a new file with matroshka container. Import that into kdenlive and the sound drift should be gone. You can also replace flac by wav which is a uncompressed and lossless codec.

For more information on demuxing and muxing (that's what you do above), see:
https://stackoverflow.com/questions/129 ... ping-issue

Good luck!

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], exahamza, Google [Bot], jkurutz, Majestic-12 [Bot], razorrob, shevchuk, Sogou [Bot]