带有水印和音频的 FFmpeg 连接“过滤器图描述中的流说明符不匹配任何流”。

Posted

技术标签:

【中文标题】带有水印和音频的 FFmpeg 连接“过滤器图描述中的流说明符不匹配任何流”。【英文标题】:FFmpeg concat with watermarks and audio "stream specifier in filtergraph description matches no streams." 【发布时间】:2016-03-26 20:03:37 【问题描述】:

我正在尝试用一系列水印连接任意数量的视频:

ffmpeg -i segment0.mp4 -i segment1.mp4 -i ... segmentn.mp4 -i end.mp4 -i ../../watermark/watermark1280/watermark_%05d.png -filter_complex "[0:v][1:v]...[n:v]concat=n=n:v=1:a=0 [v], [v] overlay [p]" -map "[v]" -an -y output.mp4

我收到以下错误:

Stream specifier ':v' in filtergraph description [0:v][1:v]...[n:v]concat=n=n:v=1:a=0 [v], [v] overlay [p] matches no streams.

这是我最近一次尝试的完整输出:

ffmpeg version N-78734-g666e2ed Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --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-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 25.101 / 57. 25.101 libavformat 57. 26.100 / 57. 26.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 36.100 / 6. 36.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'segment0.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.26.100 Duration: 00:00:02.01, start: 0.010000, bitrate: 6 kb/s Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default) Metadata: handler_name : SoundHandler Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'segment1.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.26.100 Duration: 00:00:01.99, start: 0.066000, bitrate: 5014 kb/s Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv), 1280x720, 5008 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default) Metadata: handler_name : VideoHandler Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'segment2.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.26.100 Duration: 00:00:02.01, start: 0.009000, bitrate: 424 kb/s Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 1111 kb/s, 59 fps, 59 tbr, 15104 tbn, 118 tbc (default) Metadata: handler_name : VideoHandler Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default) Metadata: handler_name : SoundHandler Input #3, mov,mp4,m4a,3gp,3g2,mj2, from 'segment3.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.26.100 Duration: 00:00:01.85, start: 0.205000, bitrate: 5058 kb/s Stream #3:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv), 1280x720, 5050 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default) Metadata: handler_name : VideoHandler Input #4, mov,mp4,m4a,3gp,3g2,mj2, from 'segment4.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.26.100 Duration: 00:00:01.77, start: 0.282000, bitrate: 5174 kb/s Stream #4:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv), 1280x720, 5167 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default) Metadata: handler_name : VideoHandler Input #5, mov,mp4,m4a,3gp,3g2,mj2, from 'segment5.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.26.100 Duration: 00:00:02.01, start: 0.006000, bitrate: 955 kb/s Stream #5:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 1448 kb/s, 59 fps, 59 tbr, 15104 tbn, 118 tbc (default) Metadata: handler_name : VideoHandler Stream #5:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default) Metadata: handler_name : SoundHandler Input #6, mov,mp4,m4a,3gp,3g2,mj2, from '../../slate/Void_test.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.26.100 Duration: 00:00:02.97, start: 0.000000, bitrate: 3176 kb/s Stream #6:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 3169 kb/s, 59.94 fps, 59.94 tbr, 11988 tbn, 119.88 tbc (default) Metadata: handler_name : VideoHandler Input #7, image2, from '../../watermark/watermark1280/watermark_%05d.png': Duration: 00:00:14.40, start: 0.000000, bitrate: N/A Stream #7:0: Video: png, ya8(pc), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc Stream specifier ':v' in filtergraph description [0:v][1:v][2:v][3:v][4:v][5:v][6:v]concat=n=7:v=1:a=0 [v], [v] overlay [p] matches no streams.

另外,如果有人可以帮助我在整个连接视频上使用单个 mp3 音频输入来完成此操作,那也会很有帮助。

【问题讨论】:

segment0没有视频流,但是你在concat中引用了它。 @Mulvya 确实。谢谢。 【参考方案1】:

另外,如果有人可以通过单个 mp3 音频输入帮助我做到这一点 在整个连接的视频中,这也很有帮助。

如果您将 mp3 输入为 n+1 输入,则应在末尾添加-map n+1:a

实际上你写-map "[v]"是你真的想得到还是需要写-map [p]

【讨论】:

以上是关于带有水印和音频的 FFmpeg 连接“过滤器图描述中的流说明符不匹配任何流”。的主要内容,如果未能解决你的问题,请参考以下文章

视频添加水印

为啥带有 2 个视频的 ffmpeg concat 会丢失第二个音频?

JAVA调用FFmpeg实现音视频转码加水印功能

使用 FFMPEG 连接某些 mp4 文件时听不到音频 [重复]

FFmpeg滤镜使用

带有音频和视频过滤器的 ffplay / ffmpeg 设置表