![FFMPEG Concat Silence 和 10 通道 WAV](https://linux22.com/image/1556061/FFMPEG%20Concat%20Silence%20%E5%92%8C%2010%20%E9%80%9A%E9%81%93%20WAV.png)
我尝试使用 concat 将生成的一些静音内容连接到 WAV 文件。当 WAV 是单声道、立体声等时,此方法可以正常工作 - 但当我们有 10 个音频通道时,此方法就会出错;
ffmpeg -f lavfi -i aevalsrc=0^|0^|0^|0^|0^|0^|0^|0^|0^|0:durat
ion=0.02 -i "10channel.WAV" -filter_complex "[1:a] [0:a] concat=n=2:v=0:a=1 [
a]" -map [a] -acodec pcm_s24le -ar 48000 -ac 10 "output.wav"
ffmpeg version N-90315-gf706cdda56 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab
le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li
bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en
able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl
e-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-ffnvcodec --en
able-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enabl
e-avisynth
libavutil 56. 9.100 / 56. 9.100
libavcodec 58. 14.100 / 58. 14.100
libavformat 58. 10.100 / 58. 10.100
libavdevice 58. 2.100 / 58. 2.100
libavfilter 7. 13.100 / 7. 13.100
libswscale 5. 0.102 / 5. 0.102
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
Input #0, lavfi, from 'aevalsrc=0|0|0|0|0|0|0|0|0|0:duration=0.02':
Duration: N/A, start: 0.000000, bitrate: 28224 kb/s
Stream #0:0: Audio: pcm_f64le, 44100 Hz, 10 channels, dbl, 28224 kb/s
Input #1, wav, from '\\gpsnearline1\000003_gps_offline\01_native\01_rushes\audio
\SR_02BEAR_AND_SWAN\2ACTIVITYT04.WAV':
Metadata:
comment : sSPEED=025.000-ND
: sTAKE=04
: sUBITS=$00000000
: sSWVER=4.00.18
: sSCENE=2ACTIVITY
: sFILENAME=2ACTIVITYT04.WAV
: sTAPE=170518
: sCIRCLED=FALSE
: sTRK1=MixL
: sTRK2=MixR
: sTRK3=BOOM
: sTRK4=HENRY
: sTRK5=SAM
: sTRK6=LISA
: sTRK7=TONY
: sTRK8=JORGE
: sTRK9=MARTYN
: sTRK10
encoded_by : Sound Dev: Mix688 S#NR0316238011
originator_reference: USSDVNR0316238011170518Fh8CY 01
date : 2017-05-18
creation_time : 15:43:16
time_reference : 2714688001
coding_history : A=PCM,F=48000,W=24,M=multi,R=48000,T=10 Ch
:
Duration: 00:04:22.00, bitrate: 11520 kb/s
Stream #1:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 10 channels
, s32 (24 bit), 11520 kb/s
File '\\Autoingestsd1\ai_cache\GPS\wavtest.wav' already exists. Overwrite ? [y/N
] y
Stream mapping:
Stream #0:0 (pcm_f64le) -> concat:in1:a0
Stream #1:0 (pcm_s24le) -> concat:in0:a0
concat -> Stream #0:0 (pcm_s24le)
Press [q] to stop, [?] for help
[Parsed_aevalsrc_0 @ 0000002f39fecb80] EOF timestamp not reliable
[auto_resampler_0 @ 0000002f3e4323c0] Cannot select channel layout for the link
between filters auto_resampler_0 and Parsed_concat_0.
[auto_resampler_0 @ 0000002f3e4323c0] Unknown channel layouts not supported, try
specifying a channel layout using 'aformat=channel_layouts=something'.
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!
无论我做什么 - 我都会收到未知的布局错误或不受支持的布局错误。
有什么方法可以让 FFMPEG 不关心布局,而只进行简单的文字 1:1 映射?
答案1
如果你想在结尾处添加静音,只需将其填充即可
ffmpeg -i "10channel.WAV" -af apad=pad_len=0.02*48000 -c:a pcm_s24le -ar 48000 -ac 10 "output.wav"