ffmpeg:混合/合并多个mp3文件,有些不混合

时间:2018-08-28 18:32:12

标签: ffmpeg centos mp3 centos7 mix

我正在尝试在CentOS 7服务器上相互合并多个mp3文件。

我正在尝试使用ffmpeg,但结果好坏参半。例如,在混合4个文件时,最后一个文件不会与其他文件混合,并且在最终输出中听不到声音。

如果我将此文件与另外一个或两个文件混合在一起(因此最多合并了3个文件),它将起作用。

合并时有限制吗?作为参考,每个文件的大小约为10mb,长度为5:00分钟。

这是我正在使用的命令

ffmpeg -i /var/www/vhosts/site/httpdocs/uploads/tracks/1.mp3 -i /var/www/vhosts/site/httpdocs/uploads/tracks/2.mp3 -i /var/www/vhosts/site/httpdocs/uploads/tracks/3.mp3 -i /var/www/vhosts/site/httpdocs/uploads/tracks/4.mp3 -filter_complex amerge -ac 2 -c:a libmp3lame -q:a 4 /var/www/vhosts/site/httpdocs/uploads/mix.mp3

合并后的输出是这样:

ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  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
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[mp3 @ 0x1c8ba60] Skipping 0 bytes of junk at 1044.
Input #0, mp3, from '/var/www/vhosts/site/httpdocs/uploads/tracks/1.mp3':
  Duration: 00:05:44.08, start: 0.025057, bitrate: 320 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
    Metadata:
      encoder         : LAME3.98r
    Side data:
      replaygain: track gain - 6.000000, track peak - unknown, album gain - unknown, album peak - unknown,
[mp3 @ 0x1c8eac0] Skipping 0 bytes of junk at 2446.
[mp3 @ 0x1c8eac0] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from '/var/www/vhosts/site/httpdocs/uploads/tracks/2.mp3':
  Metadata:
    genre           : Other
  Duration: 00:05:44.19, start: 0.000000, bitrate: 320 kb/s
    Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
[mp3 @ 0x1c9d640] Skipping 0 bytes of junk at 1044.
Input #2, mp3, from '/var/www/vhosts/site/httpdocs/uploads/tracks/3.mp3':
  Duration: 00:05:44.08, start: 0.025057, bitrate: 320 kb/s
    Stream #2:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
    Metadata:
      encoder         : LAME3.98r
    Side data:
      replaygain: track gain - 3.400000, track peak - unknown, album gain - unknown, album peak - unknown,
[mp3 @ 0x1cc2b80] Skipping 0 bytes of junk at 1044.
Input #3, mp3, from '/var/www/vhosts/site/httpdocs/uploads/tracks/4.mp3':
  Duration: 00:05:44.08, start: 0.025057, bitrate: 320 kb/s
    Stream #3:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
    Metadata:
      encoder         : LAME3.98r
    Side data:
      replaygain: track gain - 12.100000, track peak - unknown, album gain - unknown, album peak - unknown,
[Parsed_amerge_0 @ 0x1cc34e0] No channel layout for input 1
[Parsed_amerge_0 @ 0x1cc34e0] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
Output #0, mp3, to '/var/www/vhosts/site/httpdocs/uploads/mix.mp3':
  Metadata:
    TSSE            : Lavf56.40.101
    Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p (default)
    Metadata:
      encoder         : Lavc56.60.100 libmp3lame
Stream mapping:
  Stream #0:0 (mp3) -> amerge:in0
  Stream #1:0 (mp3) -> amerge:in1
  amerge -> Stream #0:0 (libmp3lame)
Press [q] to stop, [?] for help
size=    2360kB time=00:05:44.03 bitrate=  56.2kbits/s
video:0kB audio:2360kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.010468%

是否有办法解决这个问题,或者至少知道问题是什么?

另外,有人推荐sox,但我不知道如何在CentOS上安装它。

任何其他替代方法也将有所帮助。

谢谢

0 个答案:

没有答案