ffmpeg - FFMPEG concat 过滤器具有未连接的音频输出
问题描述
我正在尝试将任意视频文件与 5 秒黑色的视频文件连接起来。这是我正在使用的命令:
ffmpeg -i tmp/converted_one_1234.mp4 -i public/empty.mp4 -vsync 2 -filter_complex "[0:v]scale=1024:576:force_original_aspect_ratio=decrease,pad=1024:576:(ow-iw)/2:(oh-ih)/2,setsar=1[v0]; [1:v]scale=1024:576:force_original_aspect_ratio=decrease,pad=1024:576:(ow-iw)/2:(oh-ih)/2,setsar=1[v1]; [v0][0:a][v1][1:a]concat=n=2:v=1:a=1[v][a]" -map [v] -map [a] output.mp4
和错误:
Filter concat:out:a0 has an unconnected output
所以我理解问题是有一个音频流没有映射到输出。任意视频中有音频,黑色视频在技术上没有声音,但它有一个音频流(用 ffprobe 验证)。
我想我只是想念这里的语法是如何工作的。我尝试从本节中删除音频输入:
[v0][0:a][v1]concat=n=2:v=1:a=1[v][a]
但它不起作用。如何避免此错误?
使用 ffmpeg 事件的完整日志进行编辑(我应该注意,在此失败操作之前,有一个将任意视频转换为 mp4。无论是否包含第一次转换,concat 都会失败):
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'http://s3.amazonaws.com/bucket/27173/custom_video/final/IMG_2753.mp4?1625616358':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.76.100
Duration: 00:00:15.93, start: 0.000000, bitrate: 802 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 320x568, 723 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : Core Media Video
vendor_id : [0][0][0][0]
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 70 kb/s (default)
Metadata:
handler_name : Core Media Audio
vendor_id : [0][0][0][0]
File 'tmp/converted_one_27173.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> mp2 (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7fe770820400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fe770820400] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x7fe770820400] 264 - core 163 r3060 5db6aa6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'tmp/converted_one_27173.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.76.100
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 320x568, q=2-31, 30 fps, 15360 tbn (default)
Metadata:
handler_name : Core Media Video
vendor_id : [0][0][0][0]
encoder : Lavc58.134.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1(und): Audio: mp2 (mp4a / 0x6134706D), 44100 Hz, mono, s16, 384 kb/s (default)
Metadata:
handler_name : Core Media Audio
vendor_id : [0][0][0][0]
encoder : Lavc58.134.100 mp2
frame= 478 fps=353 q=-1.0 Lsize= 2033kB time=00:00:15.89 bitrate=1047.8kbits/s speed=11.7x
video:1271kB audio:747kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.769286%
[libx264 @ 0x7fe770820400] frame I:11 Avg QP:23.67 size: 9018
[libx264 @ 0x7fe770820400] frame P:200 Avg QP:25.18 size: 4565
[libx264 @ 0x7fe770820400] frame B:267 Avg QP:30.02 size: 1081
[libx264 @ 0x7fe770820400] consecutive B-frames: 20.5% 12.1% 8.8% 58.6%
[libx264 @ 0x7fe770820400] mb I I16..4: 9.3% 78.4% 12.3%
[libx264 @ 0x7fe770820400] mb P I16..4: 10.3% 32.2% 1.0% P16..4: 34.0% 12.3% 5.0% 0.0% 0.0% skip: 5.2%
[libx264 @ 0x7fe770820400] mb B I16..4: 1.0% 4.2% 0.1% B16..8: 50.8% 4.2% 0.3% direct: 1.7% skip:37.6% L0:52.8% L1:42.8% BI: 4.4%
[libx264 @ 0x7fe770820400] 8x8 transform intra:75.0% inter:70.6%
[libx264 @ 0x7fe770820400] coded y,uvDC,uvAC intra: 47.7% 64.1% 8.5% inter: 17.0% 19.6% 2.4%
[libx264 @ 0x7fe770820400] i16 v,h,dc,p: 17% 21% 8% 53%
[libx264 @ 0x7fe770820400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 23% 15% 5% 7% 7% 7% 5% 7%
[libx264 @ 0x7fe770820400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 24% 14% 5% 9% 7% 9% 5% 6%
[libx264 @ 0x7fe770820400] i8c dc,h,v,p: 47% 25% 20% 8%
[libx264 @ 0x7fe770820400] Weighted P-Frames: Y:11.5% UV:5.5%
[libx264 @ 0x7fe770820400] ref P L0: 73.5% 12.0% 11.9% 2.0% 0.5%
[libx264 @ 0x7fe770820400] ref B L0: 96.0% 3.8% 0.2%
[libx264 @ 0x7fe770820400] ref B L1: 98.1% 1.9%
[libx264 @ 0x7fe770820400] kb/s:653.11
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Trailing option(s) found in the command: may be ignored.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tmp/converted_one_27173.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.76.100
Duration: 00:00:15.93, start: 0.000000, bitrate: 1045 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 320x568, 653 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : Core Media Video
vendor_id : [0][0][0][0]
Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 384 kb/s (default)
Metadata:
handler_name : Core Media Audio
vendor_id : [0][0][0][0]
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'public/empty.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.76.100
Duration: 00:00:05.01, start: 0.000000, bitrate: 17 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1024x576 [SAR 1:1 DAR 16:9], 7 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Filter concat:out:a0 has an unconnected output
解决方案
推荐阅读
- php - 谷歌金融货币转换器不工作
- javascript - 将常量值分配给变量
- casting - Coq:使用类型相等来检查定义中的术语
- c++ - GCC 中 __attribute__((unused)) 和 __attribute((unused)) 的区别
- jenkins-job-dsl - Jenkins job DSL - 让 jenkins 签出特定的提交
- ruby - 从 excel 文件中读取特定列并写入另一个 excel 文件
- reactjs - React-Native + Mobx + React Navigation:错误:MobX 注入器:存储“...”不可用!确保它是由某个 Provider 提供的
- python - 使用参数网格的自定义 GridSearch 用于隔离森林
- maven - 在 intellij 中构建 maven 项目
- r - 选择感兴趣的对象并将它们传递给 map_dfr 以绑定 R 中的行?