我试图将音频剪辑添加到一起(使用amix
),同时延迟其中一个(使用adelay
)。我使用了以下命令
ffmpeg -i org/onclassical_demo_luisi_chopin_scherzo_2_31_small-version_ii-ending.wav \
-i org/all_u_had_2_say.wav -filter_complex \
"[1]adelay=1000[del1];[0][del1]amix" out.wav
并获得以下输出
ffmpeg version N-77387-g9d38f06 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --enable-libmp3lame --enable-gpl --enable-libx264 --enable-libx265
libavutil 55. 11.100 / 55. 11.100
libavcodec 57. 18.100 / 57. 18.100
libavformat 57. 20.100 / 57. 20.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 21.100 / 6. 21.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'org/onclassical_demo_luisi_chopin_scherzo_2_31_small-version_ii-ending.wav':
Duration: 00:02:18.26, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Guessed Channel Layout for Input Stream #1.0 : mono
Input #1, wav, from 'org/all_u_had_2_say.wav':
Duration: 00:00:03.85, bitrate: 88 kb/s
Stream #1:0: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 11025 Hz, 1 channels, u8, 88 kb/s
Output #0, wav, to 'out.wav':
Metadata:
ISFT : Lavf57.20.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 11025 Hz, mono, s16, 176 kb/s (default)
Metadata:
encoder : Lavc57.18.100 pcm_s16le
Stream mapping:
Stream #0:0 (pcm_s16le) -> amix:input0
Stream #1:0 (pcm_u8) -> adelay
amix -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
Error while filtering: Cannot allocate memory
size= 83kB time=00:00:03.85 bitrate= 176.6kbits/s speed= 213x
video:0kB audio:83kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.091808%
可能首先需要处理的流(pcm_s16le, 44100 Hz, 2 channels
与pcm_u8, 11025 Hz, 1 channel
)之间存在一些不兼容性,但仅运行amix
的工作方式似乎并不真实是这样的。
答案 0 :(得分:1)
尝试新版本。或者下面的命令与当前的命令:
ffmpeg -i org/onclassical_demo_luisi_chopin_scherzo_2_31_small-version_ii-ending.wav \
-i org/all_u_had_2_say.wav -filter_complex \
"[0]aresample=48000,aformat=fltp[a];
[1]aresample=48000,aformat=fltp,asetpts=PTS+(1.000/TB)[del1]; \
[a][del1]amix" out.wav