#98 Audio artifacts after gain and resampling

open
nobody
None
5
2012-11-15
2011-02-16
Florent Rougon
No

Hello,

I have a kdenlive project that plays fine in the project monitor but shows ugly audio artifacts when rendered to DV PAL 4:3 profile.
I have narrowed down the problem in such a way that it can be reproduced with a single short clip and the melt script generated by kdenlive, which is why I am reporting it on this tracker instead of the kdenlive site. Please direct me if I am wrong.

You can find all relevant files at this address: http://people.via.ecp.fr/~flo/tmp/kdenlive.audio_pb/

The minimal project audio_pb.kdenlive simply takes video2-138.dv to which a 250 % audio gain is applied.
When rendering to DV format (output file audio_pb.dv), the audio is automatically resampled from 32 kHz to 48 kHz and the resulting audio track has very unpleasant artifacts that can be seen on the wave form with audacity, as shown in the screenshot gain+resampling48000.png compared to gain+resampling44100.png and resampling48000.png. One can see spurious samples with value 0 that don't match the original data, cause high frequencies and look like an interpolation bug (e.g., at 0.6835 and 0.6850 s).

The problem doesn't appear when the project is rendered with the gain disabled (this is resampling48000.png), nor did it happen when I tried with the gain enabled but rendering to some Ogg Theora profile (this is gain+resampling44100.png). So, it seems to be a gain + resampling combination problem. (?)

Of course, the 250 % gain causes some small parts of the audio data to be trimmed, but this is in no way the cause of the very unpleasant audio artifacts in audio_pb.dv: audio_pb.ogv (from which gain+resampling44100.png was obtained) has exactly the same trimming and shows no audio crackles. These clearly come from the anomalous samples with value 0.

The software used is from Debian squeeze (kdenlive 0.7.8-1 and MLT 0.5.6+git20100727-1).

At http://people.via.ecp.fr/~flo/tmp/kdenlive.audio_pb/scripts/ script001 is the kdenlive-generated script that generates buggy audio data. script002 is the same but with gain disabled, causing no artifacts.

For completeness, here are the commands contained in script001.sh:

SOURCE="/mm/kdenlive/roger/scripts/script001.sh.mlt"
TARGET="/mm/kdenlive/roger/audio_pb.dv"
RENDERER="/usr/bin/kdenlive_render"
MELT="/usr/bin/melt"
PARAMETERS="dv_pal avformat - /mm/kdenlive/roger/scripts/script001.sh.mlt /mm/kdenlive/roger/audio_pb.dv f=dv pix_fmt=yuv420p s=720x576 profile=dv_pal"
$RENDERER $MELT $PARAMETERS

Thanks in advance for any help fixing this bug.

Discussion

  • Dan Dennedy
    Dan Dennedy
    2011-02-16

    It is an interesting bug, and I will at least take an initial look - at least to see if I reproduce it. But I do worry it is going to be like looking for a needle in a haystack.