我正在尝试将视频的音频与音乐曲目合并,同时保持图片部分不变。为此,我尝试使用 amix 过滤器,但运行命令时 FFmpeg 似乎挂起了。我做错了什么吗?
$ ffmpeg -y -i aae635a604ff16c9a320376398ac121b_0.000_5.015.mp4 -i
full_dillon_in_pro_audio.mp3 -filter_complex
"[1:a][0:a]amix=inputs=2[m]" -map 0:v -map [m] -c:v libx264 -preset
ultrafast -c:a aac 4615491572977860225_PLzGS5hkLTwTfxlgkk0.mp4
ffmpeg version N-86394-g66cf78e Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --prefix=/usr/local
--extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib
--bindir=/usr/local/bin --disable-doc --disable-static --enable-shared
--disable-ffplay --extra-libs=-ldl --enable-version3
--enable-libfreetype --enable-libx264 --enable-gpl --enable-openssl
--enable-nonfree --disable-debug
libavutil 55. 63.100 / 55. 63.100
libavcodec 57. 96.101 / 57. 96.101
libavformat 57. 72.101 / 57. 72.101
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 91.100 / 6. 91.100
libswscale 4. 7.101 / 4. 7.101
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'aae635a604ff16c9a320376398ac121b_0.000_5.015.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Duration: 00:00:05.04, start: 0.000000, bitrate: 656 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 522 kb/s, 30 fps, 30 tbr, 15360 tbn, 60
tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandler
[mp3 @ 0xf20a60] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'full_dillon_in_pro_audio.mp3':
Metadata:
title : Dillon in Pro Audio
artist : Jingle Punks
album : YouTube Audio Library
genre : Dance & Electronic
encoder : Google
Duration: 00:01:18.84, start: 0.000000, bitrate: 320 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
Stream mapping:
Stream #0:1 (aac) -> amix:input1 (graph 0)
Stream #1:0 (mp3) -> amix:input0 (graph 0)
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
amix (graph 0) -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[libx264 @ 0xf338e0] using SAR=1/1
[libx264 @ 0xf338e0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0xf338e0] profile Constrained Baseline, level 3.1
[libx264 @ 0xf338e0] 264 - core 148 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2016 - http://www.videolan.org/x264.html - options:
cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0
8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0
threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0
keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0
crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to '4615491572977860225_PLzGS5hkLTwTfxlgkk0.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.72.101
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021),
yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps,
15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.96.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz,
stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc57.96.101 aac
<hang for more than 10 minutes>
其他更为复杂的命令在几秒或最多几分钟内运行。
答案1
这已在最新的 FFmpeg 主分支中修复,请参阅此处有关该错误的讨论:
http://www.ffmpeg-archive.org/amix-filter-hanging-td4680251.html