我正在尝试规范化视频文件(mp4)的音频,但 ffmpeg 抛出错误。
命令:
ffmpeg -i input.mp4 -af "[0:a]compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/ -20:6:0:-90:0.2[audio]" -map 0:v -map "[audio]" -codec:v copy output.mp4
输出 :
ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 19.100 / 52. 19.100
libavcodec 55. 0.100 / 55. 0.100
libavformat 55. 0.100 / 55. 0.100
libavdevice 54. 4.100 / 54. 4.100
libavfilter 3. 45.103 / 3. 45.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'filename.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1
creation_time : 2015-03-15 13:31:29
Duration: 02:49:04.00, start: 0.000000, bitrate: 1917 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 1819 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
Metadata:
creation_time : 2015-03-15 13:31:29
handler_name : video.264#trackID=1:fps=23.976 - Imported with GPAC 0.5.0-rev
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s
Metadata:
creation_time : 2015-03-15 13:31:43
handler_name : GPAC ISO Audio Handler
错误:
Output with label 'audio' does not exist in any defined filter graph, or was already used elsewhere.
我猜是一个简单的语法问题?但是,我尝试了各种方法都没有解决。
答案1
您需要使用-filter_complex
而不是-af
(或-filter:a
)。前者适用于带有标签和多个输入/输出的过滤器图。
ffmpeg -i input.mp4 -filter_complex "[0:a]compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/ -20:6:0:-90:0.2[audio]" -map 0:v -map "[audio]" -codec:v copy output.mp4