[FFmpeg-user] Audio delay doesn't work as expected

Michael Koch astroelectronic at t-online.de
Mon Aug 27 15:53:20 EEST 2018


In the first example I have two identical 1kHz sine sources. The first 
source is delayed by 0.5ms (which means 180° phase shift), and then both 
channels are mixed. This works as expected, the result is silence.

ffmpeg -f lavfi -i sine=f=1000:d=5 -f lavfi -i sine=f=1000:d=5 
-filter_complex "adelay=0.5,amix" -y test1.mp3

In the second example the only difference is that the other channel is 
delayed. The result should be the same. But it doesn't work, the result 
isn't silence. Why doesn't it work?

ffmpeg -f lavfi -i sine=f=1000:d=5 -f lavfi -i sine=f=1000:d=5 
-filter_complex "adelay=0|0.5,amix" -y test2.mp3

Uncut console outputs for both examples are below.

Thanks,
Michael


c:/ffmpeg/ffmpeg -f lavfi -i sine=f=1000:d=
5 -f lavfi -i sine=f=1000:d=5 -filter_complex "adelay=0.5,amix" -y test1.mp3
ffmpeg version N-91565-g1940c27c82 Copyright (c) 2000-2018 the FFmpeg 
developers

   built with gcc 7.3.1 (GCC) 20180722
   configuration: --enable-gpl --enable-version3 --enable-sdl2 
--enable-bzlib --e
nable-fontconfig --enable-gnutls --enable-iconv --enable-libass 
--enable-libblur
ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb 
--enable-
libopencore-amrwb --enable-libopenjpeg --enable-libopus 
--enable-libshine --enab
le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame 
--enable-li
bvpx --enable-libwavpack --enable-libwebp --enable-libx264 
--enable-libx265 --en
able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp 
--enable-
libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa 
--enabl
e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf 
--enabl
e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc 
--enable-nvdec --enab
le-dxva2 --enable-avisynth
   libavutil      56. 18.102 / 56. 18.102
   libavcodec     58. 22.100 / 58. 22.100
   libavformat    58. 17.101 / 58. 17.101
   libavdevice    58.  4.101 / 58.  4.101
   libavfilter     7. 26.100 /  7. 26.100
   libswscale      5.  2.100 /  5.  2.100
   libswresample   3.  2.100 /  3.  2.100
   libpostproc    55.  2.100 / 55.  2.100
Input #0, lavfi, from 'sine=f=1000:d=5':
   Duration: N/A, start: 0.000000, bitrate: 705 kb/s
     Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Input #1, lavfi, from 'sine=f=1000:d=5':
   Duration: N/A, start: 0.000000, bitrate: 705 kb/s
     Stream #1:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
   Stream #0:0 (pcm_s16le) -> adelay
   Stream #1:0 (pcm_s16le) -> amix:input1
   amix -> Stream #0:0 (libmp3lame)
Press [q] to stop, [?] for help
Output #0, mp3, to 'test1.mp3':
   Metadata:
     TSSE            : Lavf58.17.101
     Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, mono, fltp (default)
     Metadata:
       encoder         : Lavc58.22.100 libmp3lame
[Parsed_sine_0 @ 0000000000512840] EOF timestamp not reliable
[Parsed_sine_0 @ 0000000000514c00] EOF timestamp not reliable
size=      40kB time=00:00:05.01 bitrate=  64.7kbits/s speed=32.2x
video:0kB audio:39kB subtitle:0kB other streams:0kB global headers:0kB 
muxing ov
erhead: 0.562815%




c:/ffmpeg/ffmpeg -f lavfi -i sine=f=1000:d=
5 -f lavfi -i sine=f=1000:d=5 -filter_complex "adelay=0|0.5,amix" -y 
test2.mp3
ffmpeg version N-91565-g1940c27c82 Copyright (c) 2000-2018 the FFmpeg 
developers

   built with gcc 7.3.1 (GCC) 20180722
   configuration: --enable-gpl --enable-version3 --enable-sdl2 
--enable-bzlib --e
nable-fontconfig --enable-gnutls --enable-iconv --enable-libass 
--enable-libblur
ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb 
--enable-
libopencore-amrwb --enable-libopenjpeg --enable-libopus 
--enable-libshine --enab
le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame 
--enable-li
bvpx --enable-libwavpack --enable-libwebp --enable-libx264 
--enable-libx265 --en
able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp 
--enable-
libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa 
--enabl
e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf 
--enabl
e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc 
--enable-nvdec --enab
le-dxva2 --enable-avisynth
   libavutil      56. 18.102 / 56. 18.102
   libavcodec     58. 22.100 / 58. 22.100
   libavformat    58. 17.101 / 58. 17.101
   libavdevice    58.  4.101 / 58.  4.101
   libavfilter     7. 26.100 /  7. 26.100
   libswscale      5.  2.100 /  5.  2.100
   libswresample   3.  2.100 /  3.  2.100
   libpostproc    55.  2.100 / 55.  2.100
Input #0, lavfi, from 'sine=f=1000:d=5':
   Duration: N/A, start: 0.000000, bitrate: 705 kb/s
     Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Input #1, lavfi, from 'sine=f=1000:d=5':
   Duration: N/A, start: 0.000000, bitrate: 705 kb/s
     Stream #1:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
   Stream #0:0 (pcm_s16le) -> adelay
   Stream #1:0 (pcm_s16le) -> amix:input1
   amix -> Stream #0:0 (libmp3lame)
Press [q] to stop, [?] for help
Output #0, mp3, to 'test2.mp3':
   Metadata:
     TSSE            : Lavf58.17.101
     Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, mono, fltp (default)
     Metadata:
       encoder         : Lavc58.22.100 libmp3lame
[Parsed_sine_0 @ 00000000003f4c80] EOF timestamp not reliable
[Parsed_sine_0 @ 00000000003f2880] EOF timestamp not reliable
size=      40kB time=00:00:05.01 bitrate=  64.7kbits/s speed=45.9x
video:0kB audio:39kB subtitle:0kB other streams:0kB global headers:0kB 
muxing ov
erhead: 0.562815%



More information about the ffmpeg-user mailing list