Bug 504579

Summary: Audio thumbnail waveform doesn't match audio for longer audio-only file
Product: [Applications] kdenlive Reporter: Veronica <kde>
Component: Monitors & PlaybackAssignee: Jean-Baptiste Mardelle <jb>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 25.04.1   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 25.04.2
Sentry Crash Report:

Description Veronica 2025-05-20 20:47:58 UTC
SUMMARY
After importing a long audio file (wav in my case), the audio thumbnail which shows the waveform drifts from the audible sound itself. After a period of time the audio is quite out-of-sync from the waveform. This was not present in Kdenlive 24.x before rebuilding the audio thumbnail process.

I have published a video outlining my observation of this and comparing between 24.X and 25.X here: https://youtu.be/0iTfcZJwKSk

I can provide long audio samples on request, I've noticed that this isn't observable until about 20 minutes into the waveform or so, as the video mentions by 40 minutes it's quite pronounced.

Notably, if I ignore the waveform (audio thumbnail) and just edit "by ear", and then render that segment, the rendered audio sounds like what I'm hearing, and *not* what the waveform (audio thumbnail) looks like. Which makes me think it has to do with the rebuilding of the audio thumbnail engine.

I've tried audio files generated from multiple programs (Ardour, Audacity, Bitwig) and various import formats. Confirmed the same bug on various machines (Debian Trixie, Pop!_OS, Fedora).

STEPS TO REPRODUCE
1. Launch AppImage of Kdenlive and import a long audio file (at least 30 minutes or so)
2. When Audio Thumbnail is generated, scroll to the end of the long audio file
3. Compare audio in the thumbnail with audible audio

OBSERVED RESULT
The audio heard is not in sync with the waveform, it feels like it's 5-15 frames off.

EXPECTED RESULT
The audio heard should be in sync with the waveform.

SOFTWARE/OS VERSIONS
Windows: n/a
macOS: n/a
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: Debian 13 with GNOME, Fedora 42 with GNOME, Pop!_OS 24.04 with COSMIC
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
KDE Flatpak Runtime 6.9 (observed via Flatpak)

Thank you so much!
Comment 1 Jean-Baptiste Mardelle 2025-05-21 10:59:05 UTC
Thanks for your report. I could not reproduce in a quick test with an Mp3 file.
Could you please give me more infos about the audio file used ? 
Output of this command would be great:

ffmpeg -i your_audio.wav
Comment 2 Veronica 2025-05-21 12:58:28 UTC
(In reply to Jean-Baptiste Mardelle from comment #1)
> Thanks for your report. I could not reproduce in a quick test with an Mp3
> file.
> Could you please give me more infos about the audio file used ? 
> Output of this command would be great:
> 
> ffmpeg -i your_audio.wav

Sure thing:

ffmpeg version 7.1.1-1+b1 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 14 (Debian 14.2.0-19)
  configuration: --prefix=/usr --extra-version=1+b1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=1+b1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared --enable-version3 --disable-doc --disable-programs --disable-static --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.101 / 61. 19.101
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
[aist#0:0/pcm_s16le @ 0x556144c6ee40] Guessed Channel Layout: stereo
Input #0, wav, from 'VE048 - loud.wav':
  Duration: 00:40:55.98, bitrate: 1536 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Comment 3 Jean-Baptiste Mardelle 2025-05-21 14:26:09 UTC
Git commit 73c4623b6829076dfcc0dfdac8cba1667014255a by Jean-Baptiste Mardelle.
Committed on 21/05/2025 at 14:25.
Pushed by mardelle into branch 'master'.

Fix small error causing offset in long audio thumbnails

M  +1    -1    src/jobs/audiolevels/generators.cpp

https://invent.kde.org/multimedia/kdenlive/-/commit/73c4623b6829076dfcc0dfdac8cba1667014255a
Comment 4 Jean-Baptiste Mardelle 2025-05-21 14:26:41 UTC
Git commit b66509a508cc0c0cb99d915a27818259a19b6e9e by Jean-Baptiste Mardelle.
Committed on 21/05/2025 at 14:26.
Pushed by mardelle into branch 'release/25.04'.

Fix small error causing offset in long audio thumbnails

M  +1    -1    src/jobs/audiolevels/generators.cpp

https://invent.kde.org/multimedia/kdenlive/-/commit/b66509a508cc0c0cb99d915a27818259a19b6e9e
Comment 5 Jean-Baptiste Mardelle 2025-05-21 15:12:00 UTC
Thanks for your feedback. I think I found and fixed the problem. Could you test our dev AppImage to confirm the fix ?
It is available here:
https://cdn.kde.org/ci-builds/multimedia/kdenlive/release-25.04/linux/
Comment 6 Veronica 2025-05-21 15:52:25 UTC
(In reply to Jean-Baptiste Mardelle from comment #5)
> Thanks for your feedback. I think I found and fixed the problem. Could you
> test our dev AppImage to confirm the fix ?
> It is available here:
> https://cdn.kde.org/ci-builds/multimedia/kdenlive/release-25.04/linux/

Importing the same audio file into a new project with the dev AppImage worked as expected!

I believe existing audio thumbnails are not automatically regenerated, from what I can tell. That's a simple enough problem to solve on my end, and I'm looking forward to the fix being pushed out. Thank you so much for all you do!
Comment 7 Jean-Baptiste Mardelle 2025-05-21 16:01:36 UTC
Great thanks for your confirmation. Right clicking in a Bin clip and selecting "Reload clip" will regenerate the audio thumbnails. 
The fix will be in 25.04.2 that should be available around the 9th of June.