Bug 454832

Summary: Kdenlive ignores milliseconds in entry position when importing an old project file
Product: [Applications] kdenlive Reporter: Roland Tapken <kde>
Component: Project Bin & ImportAssignee: Jean-Baptiste Mardelle <jb>
Status: REPORTED ---    
Severity: major CC: fritzibaby, kde
Priority: NOR    
Version First Reported In: 21.04.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Roland Tapken 2022-06-04 13:14:48 UTC
SUMMARY
***
Kdenlive ignores milliseconds in "in" and "out" when importing an old project file.

I've imported a Kdenlive project from 2017 and noticed that the audio was out of sync. I've investigated the problem and found out that Kdenlive seems to ignore the millisecond part when converting the old frame based "in" and "out" attributes to timestamp.

For example, the old project file declares:

    <entry out="51638" producer="3_playlist2_audio" in="42914">

After importing and saving this becomes:

   <entry producer="3_playlist2_audio" in="00:28:36.000" out="00:34:25.000">

Let's calculate... frame 42914 translated to 00:28:36.560 based on 25fps, and frame 51638 to 00:34:25.520, so the audio becomes out of sync by half a second. I also entrys where the audio was nearly one second out of sync due to this problem.

This problem effects both audio and video entries:

  Old: <entry out="49723" producer="1_video" in="36740">
  New: <entry producer="1_video" in="00:24:29.000" out="00:33:08.000">
  Correct timestamp of 36740 is 00:24:29.840, of 49723 is 00:33:08.920

***


STEPS TO REPRODUCE
1. Take a project file from Kdenlive 16.08.3
2. Open that file with version 21.04.3
3. Save that project

OBSERVED RESULT
Audio becomes out of sync

EXPECTED RESULT
Audio in sync

SOFTWARE/OS VERSIONS
KDE Frameworks 5.86.0
Qt 5.15.2 (kompiliert gegen 5.15.2)
Das xcb Fenstersystem
Comment 1 Roland Tapken 2022-06-04 13:39:59 UTC
I just tried to reproduce the problem, it seems to be a two-step bug:

After the first save, the old

    <entry out="49723" producer="1_video" in="36740">

becomes 

   <entry producer="1_video" in="00:24:29,600" out="00:33:08,920">

Notice the "comma" instead of the "dot" as decimal separator, this indicates a locale problem.

After opening and saving again, the part behind the "," gets dropped and replaced by ".000"

  <entry producer="1_playlist1_audio" in="00:24:29.000" out="00:33:10.000">

So it seems that the problem is not while opening an old project file but when saving it and it becomes converted into the new format.