Opened 11 months ago

Closed 10 months ago

Last modified 3 months ago

#9342 closed defect (invalid)

Audio clipping when joining segments with aselect filter

Reported by: xamarin Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:
Create a destination video by cutting 2 pieces of video from a big file and merging them together. In they place where they join, it produces a clipping noise on speakers, due to the sound waveform.

% ffmpeg -report -y -i in.mp4 -vf "select='between(t,72.75,74)+between(t,644.7,670)', setpts=N/FRAME_RATE/TB" -af "aselect='between(t,72.75,74)+between(t,644.7,670)', asetpts=N/SR/TB" -c:v libx265 -x265-params pass=1 -b:v 1700k -c:a aac -b:a 160k -f mp4 NUL && ffmpeg -y -i in.mp4 -vf "select='between(t,72.75,74)+between(t,644.7,670)', setpts=N/FRAME_RATE/TB" -af "aselect='between(t,72.75,74)+between(t,644.7,670)', asetpts=N/SR/TB" -c:v libx265 -x265-params pass=2 -b:v 1700k -c:a aac -b:a 160k -f mp4 out.mp4
$ ffmpeg --version
ffmpeg version 2021-07-21-git-f614390ecc-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.3.0 (Rev5, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --en
able-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpe
g --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva
2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc
--enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      57.  1.100 / 57.  1.100
  libavcodec     59.  3.102 / 59.  3.102
  libavformat    59.  4.101 / 59.  4.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.103 /  8.  0.103
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100

Attachments (2)

waveform-clipping-on-Audacity.png (65.0 KB ) - added by xamarin 11 months ago.
Representation of the waveform on Audacity at merging point
piece.wav (14.5 KB ) - added by xamarin 11 months ago.
Audio segment where the clipping happens

Download all attachments as: .zip

Change History (4)

by xamarin, 11 months ago

Representation of the waveform on Audacity at merging point

by xamarin, 11 months ago

Attachment: piece.wav added

Audio segment where the clipping happens

comment:1 by Elon Musk, 10 months ago

Resolution: invalid
Status: newclosed

This bug report makes no sense.

Selecting random audio from random points and joining them and expect fluid transformation is unrealistic. If you really need it, you can sort of do it with acrossfade filter. But that is just a hack, if 2 segments diverge drastically and crossfading is short you will get distortions or clicks or both.

comment:2 by xamarin, 3 months ago

That's the answer I was waiting for. Great explanation.

Note: See TracTickets for help on using tickets.