Bug 451971

Summary: Waveform audio visualization doesn't display correctly for some clips
Product: [Applications] kdenlive Reporter: Mazin07 <mazin07+kde>
Component: Timeline & EditingAssignee: Jean-Baptiste Mardelle <jb>
Status: CONFIRMED ---    
Severity: normal CC: erjiang, fritzibaby, kolloom
Priority: NOR    
Version First Reported In: git-master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Demo file showing this bug
waveform misalign

Description Mazin07 2022-03-27 20:09:42 UTC
Created attachment 147776 [details]
Demo file showing this bug

SUMMARY

I am using SimpleScreenRecorder to record some desktop clips including captured audio from the programs. The audio plays fine in kdenlive and any other program I use, but the visualization is incorrect, making it useless for editing.

File is a MKV with Vorbis audio.

STEPS TO REPRODUCE
1. Download the attached video file and add to a Kdenlive project.

OBSERVED RESULT
Audio visualization doesn't match actual audio.

EXPECTED RESULT
Audio visualization matches actual audio.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Ubuntu 20.04.4
(available in About System)
Kdenlive: 	kdenlive-master-165-linux-centos_64-gcc.AppImage	Mar 24, 2022
Comment 1 erjiang 2022-05-11 03:11:56 UTC
The bug is because the audio in the demo file is not centered at zero.  Looks like Kdenlive shows audio amplitude as `max(highest_value, -lowest_value)` but it would need to instead calculate the value range within each time window. Otherwise a silent audio track that's not centered at zero will look like a non-silent track.
Comment 2 thompson 2022-09-18 01:04:03 UTC
Created attachment 152175 [details]
waveform misalign
Comment 3 thompson 2022-09-18 01:04:29 UTC
I would also add to this. I rendered out a 4 audio track video. Beside the issue of volume not displayed correctly, the waveforms are also offset and no longer aligned with master bus (track1) 

above kdenlive 22.04.3 on windows 10

below davinci resolve 18.0.36