mlt icon indicating copy to clipboard operation
mlt copied to clipboard

mlt + kdenlive: sound crackling issue

Open SpidFightFR opened this issue 3 years ago • 22 comments

Hello everyone, i have a little issue with MLT and kdenlive. When i render a video, the audio seems to be crackling, it also happens when i run the mlt command without using kdenlive.

How can i fix that issue ? Is it linked to a wrong configuration ?

Here's my hardware specs:

hardware specs
- CPU: Ryzen 5 2600
- RAM: 16Gb
- GPU: Nvidia GTX 1060
Software versions
- Linux kernel version: 5.18.9-zen1-1-zen
- mlt version: 7.8.0-1
- kdenlive version: latest git version

Thank you for your help !

SpidFightFR avatar Jul 07 '22 12:07 SpidFightFR

Does the crackling happen for all source clips, or just from a specific source? Crackling audio is a common problem for source clips that are variable frame rate. OBS and other screen capture programs often create VRF unless they are configured properly.

bmatherly avatar Jul 07 '22 12:07 bmatherly

What version of Kdenlive are you using? I've seen issues with crackling happening with flac files, is your audio flac?

frdbr avatar Jul 07 '22 12:07 frdbr

I've seen issues with crackling happening with flac files, is your audio flac? This FLAC issue is still unresolved. https://github.com/mltframework/mlt/issues/741

bmatherly avatar Jul 07 '22 12:07 bmatherly

Does the crackling happen for all source clips, or just from a specific source? Crackling audio is a common problem for source clips that are variable frame rate. OBS and other screen capture programs often create VRF unless they are configured properly.

@bmatherly The base clips are intact, that's where i'm confused. At first i thought it was a problem with OBS, but the obs output files don't have this issue. Same for the music files and sounds files.

SpidFightFR avatar Jul 07 '22 13:07 SpidFightFR

What version of Kdenlive are you using? I've seen issues with crackling happening with flac files, is your audio flac?

@frdbr the version i use for kdenlive is the latest git version (i use the kdenlive-git AUR package apparently it's the version 22.07.70.r16280-1 according to the AUR, but i'm not sure).

Also that issue wasn't on the windows version of Kdenlive, it happened when i switched to linux (it happens with the Linux version).

As for flac files, i don't use flac files.

SpidFightFR avatar Jul 07 '22 13:07 SpidFightFR

What version of Kdenlive are you using? I've seen issues with crackling happening with flac files, is your audio flac?

@frdbr the version i use for kdenlive is the latest git version (i use the kdenlive-git AUR package apparently it's the version 22.07.70.r16280-1 according to the AUR, but i'm not sure).

Try to see if you can reproduce this using the AppImage and let us know.

Also that issue wasn't on the windows version of Kdenlive, it happened when i switched to linux (it happens with the Linux version).

Can you share a sample of your footage so I can try to reproduce?

As for flac files, i don't use flac files.

Good!

frdbr avatar Jul 07 '22 13:07 frdbr

Can you share a sample of your footage so I can try to reproduce?

Hey, thanks for your response, well, i can't really share the sample since i use multiple source files that are dispatched in my pc.

Fortunately, it doesn't depend on the footage itself, it happens with every "heavy" editing i try to make: with video, music, and at least a transform or a transition (or both), at the same time. The quick video i showed you is just an example, but it happens at the beginning of the video too (the music has artifacts at the very begging for a few seconds)...

Sorry if it didn't answered your question...! 😅

SpidFightFR avatar Jul 07 '22 15:07 SpidFightFR

Try to see if you can reproduce this using the AppImage and let us know.

I tried to launch an Appimage version of Kdenlive, and it doesn't seem to work, maybe because i'm using wayland.

It says core dumped

SpidFightFR avatar Jul 07 '22 15:07 SpidFightFR

Have reported this to Kdenlive's bug tracker, thinking it was a kdenlive bug. The crackling was not noticeable on 25fps video and flac audio, but when I started using 60fps video, the crackling became audible and annoying. Here is an example video where you can hear the crackle. https://youtu.be/ywQ5Sclv6-M

This is with kdenlive and mlt both pulled from git master and built from source on Arch Linux on 2023-03-04 System information: Operating System: Arch Linux KDE Plasma Version: 5.27.2 KDE Frameworks Version: 5.103.0 Qt Version: 5.15.8 Kernel Version: 6.2.2-AMD-znver2 (64-bit) Graphics Platform: X11 Processors: 8 × AMD Ryzen 7 4700U with Radeon Graphics Memory: 36.9 GiB of RAM Graphics Processor: AMD Radeon Graphics Manufacturer: LENOVO Product Name: 20T8001JUS System Version: ThinkPad E15 Gen 2

evertvorster avatar Mar 06 '23 12:03 evertvorster

Have reported this to Kdenlive's bug tracker, thinking it was a kdenlive bug.

Is your source clip variable frame rate?

bmatherly avatar Mar 07 '23 04:03 bmatherly

Hi Brian. I captured the source clip with OBS studio. Here are the sound settings: image

And here are the video settings: image

I hope this helps.

evertvorster avatar Mar 07 '23 08:03 evertvorster

Oh, this may be important too: image

evertvorster avatar Mar 07 '23 08:03 evertvorster

I do not use OBS. So I do not know about the settings. Maybe a thread like this is helpful (there are many more out there): https://obsproject.com/forum/threads/how-to-set-obs-to-record-in-constant-frame-rate.148781/

FFProbe is an easy way to see if your source clip is variable frame rate.

bmatherly avatar Mar 07 '23 13:03 bmatherly

Here is the ffprobe output on the source footage: [evert@Evert XO Fighter]$ ffprobe 2023-03-03\ 00-13-18.mp4 ffprobe version n5.1.2 Copyright (c) 2007-2022 the FFmpeg developers built with gcc 12.2.1 (GCC) 20230201 configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2023-03-03 00-13-18.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf59.27.100 Duration: 00:04:43.20, start: 0.000000, bitrate: 412 kb/s Stream #0:00x1: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 206 kb/s, 60 fps, 60 tbr, 15360 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] Stream #0:10x2: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 193 kb/s (default) Metadata: handler_name : SoundHandler vendor_id : [0][0][0][0]

evertvorster avatar Mar 07 '23 14:03 evertvorster

For completeness, here is the mediainfo output: mediainfo 2023-03-03\ 00-13-18.mp4 General Complete name : 2023-03-03 00-13-18.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/avc1/mp41) File size : 13.9 MiB Duration : 4 min 43 s Overall bit rate : 412 kb/s Writing application : Lavf59.27.100

Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : [email protected] Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 4 min 43 s Source duration : 4 min 43 s Bit rate : 195 kb/s Maximum bit rate : 2 500 kb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 60.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.002 Stream size : 6.59 MiB (47%) Source stream size : 6.96 MiB (50%) Writing library : x264 core 164 r3095 baee400 Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=2 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=12 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=10 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709 mdhd_Duration : 283200 Codec configuration box : avcC

Audio ID : 2 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 4 min 43 s Bit rate mode : Constant Bit rate : 192 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 48.0 kHz Frame rate : 46.875 FPS (1024 SPF) Compression mode : Lossy Stream size : 6.53 MiB (47%) Title : simple_aac_recording Default : Yes Alternate group : 1

evertvorster avatar Mar 07 '23 17:03 evertvorster

In Kdenlive, we have seen reports about crackling when working with either FLAC files or in 60fps projects.

https://bugs.kde.org/show_bug.cgi?id=407346#c14

frdbr avatar Mar 07 '23 17:03 frdbr

In Kdenlive, we have seen reports about crackling when working with either FLAC files or in 60fps projects.

https://bugs.kde.org/show_bug.cgi?id=407346#c14

It would be good if someone could translate that bug report into the simplest possible melt command line. It should help to simplify the debugging.

bmatherly avatar Mar 08 '23 00:03 bmatherly

Ok, so using the sample sine wav file provided in the Kdenlive bug report: sine.flac

The problem can be reproduced using this melt command: melt -profile atsc_1080p_60 sine.flac in=735 -consumer avformat:test1.wav

The resulting file has clear audio cracks at start. Using an atsc_1080p_25 profile I didn't get audio cracks

j-b-m avatar Mar 08 '23 12:03 j-b-m

Thanks. That is helpful. But it really belongs in https://github.com/mltframework/mlt/issues/741. It seems this issue is becoming a duplicate of #741 - unless someone has a "crackling" problem that does not involve raw flac.

@SpidFightFR originally reported:

As for flac files, i don't use flac files.

That is why I kept the issue open and did not mark it as a duplicate.

@SpidFightFR or anyone else, can you provide a test case that reproduces crackling audio that does not involve FLAC files? If not, I will close this issue as duplicate.

bmatherly avatar Mar 08 '23 13:03 bmatherly

Just tested with the latest mlt-git, and kdenlive-git, and on my system the problem is completely gone. Good job!

evertvorster avatar Mar 13 '23 18:03 evertvorster

Is this ticket still relevant ?

luzpaz avatar Jun 26 '23 01:06 luzpaz

Hey lads, i still have this issue, but it seems to happen less when the volume is low... so perhaps i'll keep going that way.

SpidFightFR avatar Oct 11 '23 06:10 SpidFightFR