我试图将音频片段添加在一起(使用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
可以工作,因此实际上似乎并非如此。 最佳答案
尝试新的版本。或下面带有当前命令的命令:
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