[FFmpeg-devel] acrossfade duration accuracy

Ryan Williams ryan at ryanwilliams.id.au
Mon Nov 23 06:32:31 CET 2015


I am getting an unexpected number of samples in the output of the 'acrossfade' filter.
In the following example I would expect acrossfade.wav to contain 72,000 samples but it only contains 70,976 samples.
Am I doing something wrong?

[root at ryan ff]# ffmpeg  \
  -y \
  -vn \
  -filter_complex " \
   aevalsrc='exprs=sin(440*2*PI*t):s=8000', atrim='duration=5' [a0]; \
   aevalsrc='exprs=sin(440*2*PI*t):s=8000', atrim='duration=5' [a1]; \
   aevalsrc='exprs=sin(440*2*PI*t):s=8000', atrim='duration=5' [a2]; \
   aevalsrc='exprs=sin(440*2*PI*t):s=8000', atrim='duration=5' [a3]; \
   [a0][a1] concat='n=2:v=0:a=1' [output1]; \
   [a2][a3] acrossfade='ns=8000' [output2] \
  " \
  -map '[output1]' concat.wav \
  -map '[output2]' acrossfade.wav

ffmpeg version 2.8.2-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.1 (Debian 5.2.1-23) 20151028
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --cc=gcc
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Output #0, wav, to 'concat.wav':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 8000 Hz, mono, s16, 128 kb/s (default)
    Metadata:
      encoder         : Lavc56.60.100 pcm_s16le
Output #1, wav, to 'acrossfade.wav':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 8000 Hz, mono, s16, 128 kb/s (default)
    Metadata:
      encoder         : Lavc56.60.100 pcm_s16le
Stream mapping:
  concat -> Stream #0:0 (pcm_s16le)
  acrossfade -> Stream #1:0 (pcm_s16le)
Press [q] to stop, [?] for help
size=     156kB time=00:00:10.00 bitrate= 128.1kbits/s
video:0kB audio:295kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

[root at ryan ff]# sox --info -s concat.wav
80000

[root at ryan ff]# sox --info -s acrossfade.wav
70976



More information about the ffmpeg-devel mailing list