|Anonymous | Login | Signup for a new account||2014-10-20 06:59 CEST|
|My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002694||Kdenlive||Rendering||public||2012-08-04 13:17||2013-05-08 18:17|
|Product Version||Recent git|
|Target Version||Fixed in Version|
|Summary||0002694: Video sync drifts further behind audio in renders, while preview playback syncs perfectly|
I have a project primarily made up of a video only mkv with the ffv1 codec and a 44100khz wav for audio. There are some other files in the project, but these are the main ones.
When I play the project inside Kdenlive, they stay perfectly in sync. When I render though (and I tried many different video and audio codecs) it invariably is synced at the start, but by the time it's played 9 minutes through, the video lags by about 4-5 seconds.
Both audio and video show up as being the same length in the timeline.
I've tried this with both Kdenlive 9.2+MLT 7.2 and todays git versions of both Kdenlive and MLT.
In both cases I was using FFMPEG .10.3 (I tied doing FFMPEG straight from git, too but Kdenlive didn't detect it).
A lot of the time, when I open the file I see errors such as this:
[mp3 @ 0x2e2baa0] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x2e2baa0] Estimating duration from bitrate, this may be inaccurate
[mp3 @ 0x2e47200] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x2e47200] Estimating duration from bitrate, this may be inaccurate
[wav @ 0x2e3dec0] max_analyze_duration 5000000 reached at 5015510
[wav @ 0x2e3e960] max_analyze_duration 5000000 reached at 5015510
[wav @ 0x2eea5a0] max_analyze_duration 5000000 reached at 5015510
[wav @ 0x2eeb620] max_analyze_duration 5000000 reached at 5015510
[flac @ 0x7f73d403b1e0] max_analyze_duration 5000000 reached at 5015510
[flac @ 0x7f73d403c6e0] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x7f73d401fbe0] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x7f73d4024ee0] max_analyze_duration 5000000 reached at 5015510
[swscaler @ 0x7f73d58c0d00] Warning: data is not aligned! This can lead to a speedloss
[mpegts @ 0x7f73d5b93100] max_analyze_duration 5000000 reached at 5000000
[mpegts @ 0x7f73d5b9ab80] max_analyze_duration 5000000 reached at 5000000
[mpegts @ 0x7f73d5bc0dc0] max_analyze_duration 5000000 reached at 5000000
[mpegts @ 0x7f73d5dc73e0] max_analyze_duration 5000000 reached at 5000000
[mpegts @ 0x7f73d5dcc7a0] max_analyze_duration 5000000 reached at 5000000
[mpegts @ 0x7f73d5df4ea0] max_analyze_duration 5000000 reached at 5000000
Note: It's the wav that has the unsynced audio, so it's not just a case of "render the mp3 to wav"
When I render, a clip more than a couple of minutes long it usually crashes just after 100% outputting errors. The render command is:
//STARTING RENDERING: true , false , "/usr/bin/melt" , "atsc_720p_24" , "avformat" , "-" , "/tmp/kde-user/kdenlivedO8445.mlt" , "/tmp/youtube720standard.mp4" , () , ("f=mp4", "hq=1", "acodec=aac", "ab=128k", "ar=44100", "vcodec=mpeg4", "minrate=0", "vb=2000k", "s=1280x720", "aspect=@16/9", "mbd=2", "trellis=1", "mv4=1", "subq=7", "qmin=10", "qcomp=0.6", "qdiff=4", "qmax=51", "threads=8", "real_time=-1") , 0 , 15168
Started render process: "/usr/bin/melt" "/tmp/kde-user/kdenlivedO8445.mlt in=0 out=15168 -profile atsc_720p_24 -consumer avformat:/tmp/youtube720standard.mp4 progress=1 f=mp4 hq=1 acodec=aac ab=128k ar=44100 vcodec=mpeg4 minrate=0 vb=2000k s=1280x720 aspect=@16/9 mbd=2 trellis=1 mv4=1 subq=7 qmin=10 qcomp=0.6 qdiff=4 qmax=51 threads=8 real_time=-1"
That said, the syncing error occurs even when there is no rendering crash (although even then I still get the errors above on opening)
|Steps To Reproduce||1. Add video only mkv filt to the timeline|
2. Add matching wav soundtrack to timeline so they sync
3. Playback in Kdenlive and note that they sync properly
4. Render to any render profile (I mainly used the youtube 1280x720 one, but also the lossless h264 ones, all of the file rendering group etc)
5. Play the rendered file, and watch the video lag behind the audio by the end
|Tags||No tags attached.|
|Build/Install Method||Manual build from Git|
|Attached Files||interview-small3.mp4 [^] (1,302,980 bytes) 2012-08-04 16:25|
PS I marked this as major, as it's really not visible until the user has invested time pretty much finishing the project, and then it makes the resdulting project basically unusable.
To me this wasted more of my time than if it crashed partway through (where autosaVE helps and I only waste part of the time making the project.)
Just tested, and this still happens when using "Render with proxy clips". I tried with 8 render threads and again with just 1. Sync was lost in both cases.
I also tried just rendering the end part to see if unsyncing happened more with the length of the render, or how far through the clips was being sampled. Result: rendering just the end part produced the exact same amount of unsynchronization, as was seen in the end part of the full render.
I reinstalled Kdenlive and MLT and wiped kdenliverc and the render crash went away, but the sync problem remains, so it seems the two are unrelated.
I also reproduced the issue with only 2 files and no effects/transitions, so it seems they're not the problem either.
The render command is as follows:
//STARTING RENDERING: true , true , "/usr/bin/melt" , "atsc_720p_24" , "avformat" , "-" , "/tmp/kde-user/kdenlivem11021.mlt" , "/tmp/interview-small2.mp4" , () , ("f=mp4", "hq=1", "acodec=aac", "ab=64k", "ar=48000", "pix_fmt=yuv420p", "vcodec=libx264", "minrate=0", "vb=400k", "g=250", "bf=3", "b_strategy=1", "subcmp=2", "cmp=2", "coder=1", "flags=+loop", "flags2=dct8x8", "qmax=51", "subq=7", "qmin=10", "qcomp=0.6", "qdiff=4", "trellis=1", "aspect=@16/9", "threads=8", "real_time=-1", "s=100x56") , -1 , -1
Started render process: "/usr/bin/melt" "/tmp/kde-user/kdenlivem11021.mlt -profile atsc_720p_24 -consumer avformat:/tmp/interview-small2.mp4 progress=1 f=mp4 hq=1 acodec=aac ab=64k ar=48000 pix_fmt=yuv420p vcodec=libx264 minrate=0 vb=400k g=250 bf=3 b_strategy=1 subcmp=2 cmp=2 coder=1 flags=+loop flags2=dct8x8 qmax=51 subq=7 qmin=10 qcomp=0.6 qdiff=4 trellis=1 aspect=@16/9 threads=8 real_time=-1 s=100x56"
|Example render towards the end of the project (low resolution) attached|
edited on: 2012-08-17 23:12
EDIT: What I wrote here below is incorrect. I checked again and the error persists, it's just less noticeable.
Newsflash: I tested this on:
Kubuntu 12.04 with
with the same files, and the sync error doesn't occur, so this is clearly a regression in one or more parts of the stack. Does sunab's PPA provide FFMPEG? If not, I can test with the nightly version of Kdenlive / MLT and the 0.8.3 version of FFMPEG to see if the regression is there or somewhere else.
edited on: 2012-08-17 23:13
EDIT: The post below is incorrect. I checked again and they *both* display the error, just to varying degrees.
I just set up a completely different PC with the same versions of Kdenlive, MLT and all of the FFMPEG / libav dependencies and the exact same file renders differently on each machine?!
My laptop (64 bit dual core intel cpu) renders correctly, while my desktop (64 bit 8 core AMD) renders with the sync problem. I used exactly the same render settings on the same file on both machines. Both are running 64 bit Kubuntu 12.04 updated with no PPA's. o_O
If I remember it correct there was an issue with 64bit code in mlt and ffmpeg10.x
but I'm not sure.
Nevertheless for compiling I'd recommend Dan's build script:
For being absolutly felxible clone the complete git repos for kdenlive, mlt, ffmpeg ... Than you can just set the desired versions in git and compile.
Don't forget to start kdenlive with - "start-kdenlive". This script loads the appropriate env and starts kdenlive. Or go to the installed dir ~/kdenlive/$(date)/bin/ and load the env . ./kdenlive_env => start kdenlive with
That looks like a beautifully easy solution. Unfortunately at the moment it just gives me:
libavcodec/bintext.c:97:13: warning: 'hscroll' defined but not used [-Wunused-function]
libavcodec/bmp.c: In function 'bmp_decode_frame':
libavcodec/bmp.c:178:22: warning: 'rgb' may be used uninitialized in this function [-Wmaybe-uninitialized]
libavcodec/bmp.c:178:22: warning: 'rgb' may be used uninitialized in this function [-Wmaybe-uninitialized]
libavcodec/bmp.c:175:21: warning: 'rgb' may be used uninitialized in this function [-Wmaybe-uninitialized]
libavcodec/bmpenc.c: In function 'bmp_encode_frame':
libavcodec/bmpenc.c:71:12: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> [^] for instructions.
make: *** [libavcodec/bmpenc.o] Error 1
make: *** Waiting for unfinished jobs....
ERROR: Unable to build ffmpeg
LOG: Process has finished. Reason: FAILURE Some kind of error occured: Unable to build ffmpeg"
...but a great place to start. Now to see what I can find re: gcc segfaulting...
Ha! I disabled a bunch of options in the script and it compiles ok now. Now I'm just trying to figure out what to put as the revision number given that projects like FFMPEG only seems to have commit 'numbers' like "b00fc80d406fef0acd54619a7c82e2a31e00c06c"...
If I can get that figured out I can keep recompiling and test if the error is in MLT or FFMPEG and which commit introduced it.
Any help appreciated.
Did you clone the whole repo (depth != 0). If so type #git tag in the repo dir and checkout the wished tag e.g. for ffmpeg #git checkout n11.1. If you are not familiar with git parse the manual or use a git gui.
Repeat this steps for other repos like mlt ...
Of course in the build scripts you have to set
not to overwrite the cloned repo.
Thanks for your help Eddrog.
I've identified that the error is in MLT, and exists in versions 0.7.6 to current git. Not sure how far back it goes as I haven't had time to recompile enough times yet. Specifically, if you play OGV's with ffplay they play correctly, but with Melt they don't. I still need to try with other file formats.
I've filed a bug on the MLT bugtracker on Sourceforge, so I guess this can be closed, unless Dan wants to look at it here.
|Please let us know if/when issue is solved in MLT|
|Any feedback here with recent MLT git???|
I forwarded this issue to you as I don't feel able to handle it alone.
On my side I am stuck with A/V sync problems since this summer (upgrade to MLT 0.8.*) clearly visible with big source clips: this is a problem to share video samples for studying!
I have HD clips of 5 to 15 minute (1 to 3Gb), and when I use in the timeline small portions of them, far from the beginning of the clip, the voice is delayed sometimes about half a second (bad for an interview).
With tiny proxy clips or recompressed source clip I was preparing, the problem is much less visible or null.
Is it linked to the messages from ffmpeg I get in the console saying roughly that "analyze duration length exceeded" and "duration evaluation from bitrate is imprecise"?
Thanks for your help!
|forgot to say that in the clip monitor or without splitting audio, A/V remain in sync: this seems to be a problem with seeking audio/video separately (tested on simple cases with my biggest file, 4Gb MPEG2 1920x1080 + pcm16be)|
|@j-b-m: Is this problem a result of the change "fast seeking producer in splitted mode"? Now we have a fast transition but sync problems?|
|just a note, to say I got your pleas for help, and I will look into it over the weekend.|
The MLT bug mentioned is here and resolved: https://sourceforge.net/p/mlt/bugs/171/ [^]
Basically, there was a fix for WebM, but Ogg Theora is hit-or-miss and remains so as the same problem was apparent in ffplay.
Now, as for the problem when splitting video and audio, I have not been able to reproduce it using a 10 minute MPEG-2 video with PCM audio in MXF file placed at about the 3 minute point of a 720p25 project and rendered to DVD. I checked the result in VLC. I am using MLT git master and FFmpeg git master from Nov. 27.
|OK, I believe I have reproduced it now.|
i have suffered from this horrible bug and should be given total priority.
syncing is a big problem in kdenlive.
tip for farid & others blocked by sync issue:
on my side I temporarly reverted back to mlt 0.7.8 (+patch fixing memleak needed for big projects), allowing me to finish my projects properly.
Dan, can we help you in any way ? ... sending you cooked meals? ;-)
|I think I might have found the problem and testing a possible fix now.|
edited on: 2013-01-08 08:50
This should be fixed in MLT git commit ba392da. Let me know if you want a self-contained build to test. Let me stress that this fix only covers when you split audio and video when adding clips to the timeline.
Thanks a lot Dan! Your description corresponds exactly to my problem.
On my side I am used to install MLT from git on my system...
but I'm sorry I might not be able to test it until tomorrow evening
OK, my problem is solved, thanks a lot Dan, I now can work with all the latest versions!
Other reporters on this bug, can you confirm if everything is now fine for you (=>close ticket), or can you explain a bit further what you observe?
edited on: 2013-05-01 12:39
This looks very similar to my issue, video increasingly lags behind audio as rendered media is played. Happens on all avformat renders, not on libdv renders.
Forum post of details: http://www.kdenlive.org/forum/audio-sync-drift-video-laggs [^]
EDIT: This may be an underlying issue with MELT and 44100Hz audio rendered into 48000Hz output. I tested by upsampling my wav from 44k1 to 48k and rendered a chunk to mpeg2, and seeminly no AV sync drift. Will do a full render of my project and see if this holds.
** Update: Well, rendering the full project using the 48k upsampled wav file to a DVD vob (720x480, 48k) has no obvious AV sync issues. Thus I think there is an real issue in MELT (avformat/ffmpeg) when working with 44100Hz PCM(wav) into 48000Hz rendered output.
Hope this helps as a workaround for others, and a fix for the newbie user is possible, cheers, H.
|I have not been able to reproduce the problem reported by Infini7y after attempting for several hours over a couple of days. I am not doing any further work on this at this time.|
|2012-08-04 13:17||Zoop||New Issue|
|2012-08-04 13:21||Zoop||Note Added: 0008176|
|2012-08-04 14:57||Zoop||Note Added: 0008179|
|2012-08-04 16:24||Zoop||Note Added: 0008180|
|2012-08-04 16:25||Zoop||File Added: interview-small3.mp4|
|2012-08-04 16:26||Zoop||Note Added: 0008181|
|2012-08-06 01:18||Zoop||Note Added: 0008185|
|2012-08-06 20:07||Zoop||Note Added: 0008186|
|2012-08-06 20:40||eddrog||Note Added: 0008187|
|2012-08-07 23:57||Zoop||Note Added: 0008189|
|2012-08-08 04:27||Zoop||Note Added: 0008190|
|2012-08-08 09:31||eddrog||Note Added: 0008191|
|2012-08-17 22:52||Zoop||Note Added: 0008199|
|2012-08-17 23:12||Zoop||Note Edited: 0008185||View Revisions|
|2012-08-17 23:13||Zoop||Note Edited: 0008186||View Revisions|
|2012-08-24 11:45||vpinon||Note Added: 0008213|
|2012-08-24 11:45||vpinon||Assigned To||=> vpinon|
|2012-08-24 11:45||vpinon||Status||new => feedback|
|2012-08-24 11:48||vpinon||Relationship added||has duplicate 0002635|
|2012-08-24 12:23||vpinon||Relationship added||has duplicate 0002680|
|2012-10-15 14:51||eddrog||Note Added: 0008472|
|2012-12-13 22:55||vpinon||Relationship added||has duplicate 0002671|
|2012-12-13 22:56||vpinon||Relationship added||related to 0002846|
|2012-12-13 22:57||vpinon||Assigned To||vpinon => ddennedy|
|2012-12-13 22:57||vpinon||Status||feedback => assigned|
|2012-12-13 23:07||vpinon||Note Added: 0008775|
|2012-12-13 23:09||vpinon||Note Added: 0008776|
|2012-12-14 09:55||eddrog||Note Added: 0008777|
|2012-12-14 17:58||ddennedy||Note Added: 0008778|
|2012-12-16 03:44||ddennedy||Note Added: 0008799|
|2012-12-17 03:42||ddennedy||Note Added: 0008819|
|2013-01-07 12:33||farid||Note Added: 0009058|
|2013-01-07 18:46||vpinon||Note Added: 0009061|
|2013-01-08 08:19||ddennedy||Note Added: 0009063|
|2013-01-08 08:50||ddennedy||Note Added: 0009064|
|2013-01-08 08:50||ddennedy||Note Edited: 0009064||View Revisions|
|2013-01-08 09:18||vpinon||Note Added: 0009065|
|2013-01-18 19:24||vpinon||Note Added: 0009100|
|2013-01-18 19:24||vpinon||Status||assigned => feedback|
|2013-05-01 10:04||Infini7y||Note Added: 0009512|
|2013-05-01 10:46||Infini7y||Note Edited: 0009512||View Revisions|
|2013-05-01 12:39||Infini7y||Note Edited: 0009512||View Revisions|
|2013-05-08 18:17||ddennedy||Note Added: 0009524|
|Copyright © 2000 - 2014 MantisBT Team|