View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001034KdenliveRenderingpublic2009-07-10 05:412010-09-22 17:53
Assigned Toddennedy 
PlatformOSOS Version
Product VersionRecent git 
Target Version0.7.6Fixed in Version0.7.6 
Summary0001034: A/V drifts out of sync in long HD 1080p 23.98Hz projects
DescriptionI've been experiencing a problem where the audio and video drift out of sync in the rendered file where the frame rate is 23.98 Hz. Here's a way to reproduce it:

(1) Create a new project with the HD 1080p 23.98Hz profile.

(2) Setup the timeline like this:

00:00:00:00 - 00:01:00:00 Video Track: Color clip (black)
00:01:00:00 - 00:01:01:00 Video Track: Color clip (white), Audio Track: 1 sec tone
00:01:01:00 - 01:00:00:00 Video Track: Color clip (black)
01:00:00:00 - 01:00:01:00 Video Track: Color clip (white), Audio Track: 1 sec tone
01:00:01:00 - 01:01:00:00 Video Track: Color clip (black)

This has the effect of creating a movie that's about 1 hour long. One minute into the video, the screen turns white for 1 second and at the same time a tone plays. The same white screen/tone combination plays one hour into the movie.

Here's the file I used for a tone: [^]

(3) Render the project using MPEG-2.

(4) Play the rendered file in an external player. The tone and white screen are well synchronized at the 1 minute mark, but the tone precedes the white screen by almost two seconds at the 1 hour mark.

Alternatively, you could import the rendered file into a new kdenlive project. Exploring the file with the project monitor show that the white screens appear on exactly the correct frames, but the audio thumbnail clearly shows the audio is too early at the 1 hour mark.

My math tells me that the audio is being rendered at a speed about 0.05% too fast for some reason.

If I perform the same experiment using the HD 1080p 24Hz profile the sync is perfect throughout the file.
TagsNo tags attached.
Build/Install MethodManual build from SVN
Attached Files

- Relationships
related to 0001033closed Timecodes indicate 23 fps in HD 1080p 23.98Hz project 

-  Notes
madkins (reporter)
2009-07-26 18:17

I now think this is an MLT bug. The function mlt_sample_calculator seems to be trying to compute the number of audio samples in a frame. With this strange frame rate, there is a combination of finite precision floating point arithmetic and integer truncation that causes this calculation to be off by one sample per frame. This error accumulates when rendering a long duration project and causes a noticeable A/V sync issue.

I've posted more details and a proposed patch that seems to work for me on the mlt-devel mailing list.

We'll see what happens!
ddennedy (developer)
2009-08-08 05:08

Your more comprehensive patch was applied to MLT git commit 33098e.

- Issue History
Date Modified Username Field Change
2009-07-10 05:41 madkins New Issue
2009-07-10 05:41 madkins Build/Install Method => Manual build from SVN
2009-07-19 23:38 j-b-m Relationship added related to 0001033
2009-07-26 18:17 madkins Note Added: 0003733
2009-08-08 05:08 ddennedy Note Added: 0003777
2009-08-08 05:08 ddennedy Status new => resolved
2009-08-08 05:08 ddennedy Fixed in Version => Recent git
2009-08-08 05:08 ddennedy Resolution open => fixed
2009-08-08 05:08 ddennedy Assigned To => ddennedy
2009-09-10 01:46 xzhayon Target Version => future version
2009-10-08 20:20 j-b-m Fixed in Version Recent git => 0.7.6
2010-02-02 10:35 j-b-m Fixed in Version 0.7.6 => 0.7.7
2010-02-02 10:37 j-b-m Fixed in Version 0.7.7 => 0.7.6
2010-02-02 10:38 j-b-m Status resolved => closed
2010-09-22 17:53 Granjow Target Version future version => 0.7.6

Copyright © 2000 - 2016 MantisBT Team
Powered by Mantis Bugtracker