在 FFmpeg 中使用 afade 滤镜后添加了额外的音频时长

在 FFmpeg 中使用 afade 滤镜后添加了额外的音频时长

我正在尝试使用过滤器为音频添加淡入效果afade

音频原本是3:30及时的,但是执行此命令后:

ffmpeg -i adele.mp3 -af "afade=t=in:ss=0:d=15" test.mp3

它变成了8:01

以下是完整的日志记录:

ffmpeg version N-60332-ga0d5204 Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb  4 2014 21:31:51 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
  configuration: --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 49.101 / 55. 49.101
  libavformat    55. 29.101 / 55. 29.101
  libavdevice    55.  7.100 / 55.  7.100
  libavfilter     4.  1.102 /  4.  1.102
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mp3, from 'adele.mp3':
  Metadata:
    title           : Chasing Pavements
    artist          : Adele
    track           : 3
    album           : 19 (Deluxe Edition)
    date            : 2008
  Duration: 00:03:30.55, start: 0.025056, bitrate: 160 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 159 kb/s
    Stream #0:1: Video: mjpeg, yuvj420p(pc), 600x600 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      title           : 
      comment         : Other
File 'test.mp3' already exists. Overwrite ? [y/N] y
[swscaler @ 0x7fbec4801c00] deprecated pixel format used, make sure you did set range correctly
[mp3 @ 0x7fbec301f400] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
Output #0, mp3, to 'test.mp3':
  Metadata:
    TIT2            : Chasing Pavements
    TPE1            : Adele
    TRCK            : 3
    TALB            : 19 (Deluxe Edition)
    TLAN            : English
    TDRL            : 2008
    TSSE            : Lavf55.29.101
    Stream #0:0: Video: png, rgb24, 600x600 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 90k tbn, 90k tbc
    Metadata:
      title           : 
      comment         : Other
    Stream #0:1: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg -> png)
  Stream #0:0 -> #0:1 (mp3 -> libmp3lame)
Press [q] to stop, [?] for help
[libmp3lame @ 0x7fbec300cc00] Trying to remove 1152 samples, but the queue is empty 
frame=    1 fps=0.2 q=0.0 Lsize=    3521kB time=00:03:30.54 bitrate= 137.0kbits/s    
video:230kB audio:3290kB subtitle:0 data:0 global headers:0kB muxing overhead 0.010403%

答案1

你遇到了错误#2697: OS X 中的 MP3 输出持续时间不正确

所谓的解决方法就是添加-write_xing 0输出选项:

ffmpeg -i input.mp3 -af "afade=t=in:ss=0:d=15" -write_xing 0 output.mp3

或者您可以通过管道传输到lame

ffmpeg -i input.mp3 -af "afade=t=in:ss=0:d=15" -f wav - | lame - output.mp3

相关内容