这不应该那么难。我正在尝试结合三个不同的视频源。我将它们放大到一个一致的1280x720帧,并用黑色背景进行装箱,并尝试将其连接到输出文件。这两个输入文件是显示段,保险杠是随机播放的广告,位于中间。
在iMac Pro上,系统10.14.3,ffmpeg 4.1.1。我正在尝试执行的命令是:
ffmpeg -y -hide_banner -i "input1.mkv" -i "bumper.mkv" -i "input2.mkv" -filter_complex '[0:v]scale=1280x720:force_original_aspect_ratio=increase[v0],pad=1280x720:max(0\,(ow-iw)/2):max(0\,(oh-ih)/2):black[v0]; [1:v]scale=1280x720:force_original_aspect_ratio=increase[v1],pad=1280x720:max(0\,(ow-iw)/2):max(0\,(oh-ih)/2):black[v1]; [2:v]scale=1280x720:force_original_aspect_ratio=increase[v2],pad=1280x720:max(0\,(ow-iw)/2):max(0\,(oh-ih)/2):black[v2]; [v0][0:a][v1][1:a][v2][2:a]concat=n=3:v=1:a=1 [outv] [outa]' -map "[outv]" -map "[outa]" 'output.mkv'
我得到的结果帧是:
[h264 @ 0x7fbec9000600] [verbose] Reinit context to 720x480, pix_fmt: yuv420p
[info] Input #0, matroska,webm, from 'input1.mkv':
[info] Metadata:
[info] encoder : libebml v0.7.7 + libmatroska v0.8.1
[info] creation_time : 2009-07-20T01:33:54.000000Z
[info] Duration: 00:12:00.89, start: 0.000000, bitrate: 1323 kb/s
[info] Stream #0:0(eng): Video: h264 (High), 1 reference frame, yuv420p(progressive, left), 708x480 (720x480) [SAR 10:11 DAR 59:44], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
[info] Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 160 kb/s (default)
[info] Metadata:
[info] title : English AC3
[info] Stream #0:2(eng): Subtitle: subrip
[h264 @ 0x7fbec9019a00] [verbose] Reinit context to 304x240, pix_fmt: yuv420p
[info] Input #1, matroska,webm, from 'bumper.mkv':
[info] Metadata:
[info] CREATION_TIME : 2019-03-15T15:16:00Z
[info] ENCODER : Lavf57.7.2
[info] Duration: 00:00:18.18, start: 0.000000, bitrate: 274 kb/s
[info] Stream #1:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, smpte170m/smpte170m/bt709, progressive, left), 302x232 (304x240) [SAR 1:1 DAR 151:116], 29.97 fps, 29.97 tbr, 1k tbn, 180k tbc (default)
[info] Stream #1:1: Audio: aac (LC), 44100 Hz, stereo, fltp, delay 2111 (default)
[info] Metadata:
[info] title : Stereo
[error] Truncating packet of size 3515 to 1529
[h264 @ 0x7fbec9014600] [verbose] Reinit context to 704x480, pix_fmt: yuv420p
[h264 @ 0x7fbec9014600] [info] concealing 769 DC, 769 AC, 769 MV errors in I frame
[matroska,webm @ 0x7fbec9011e00] [error] Read error at pos. 50829 (0xc68d)
[info] Input #2, matroska,webm, from 'input2.mkv':
[info] Metadata:
[info] encoder : libebml v0.7.7 + libmatroska v0.8.1
[info] creation_time : 2009-07-19T22:37:48.000000Z
[info] Duration: 00:10:07.20, start: 0.000000, bitrate: 1391 kb/s
[info] Stream #2:0(eng): Video: h264 (High), 1 reference frame, yuv420p(progressive, left), 704x480 [SAR 10:11 DAR 4:3], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
[info] Stream #2:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 160 kb/s (default)
[info] Metadata:
[info] title : English AC3
[info] Stream #2:2(eng): Subtitle: subrip
[Parsed_scale_0 @ 0x7fbec8716540] [verbose] w:1280 h:720 flags:'bilinear' interl:0
[Parsed_scale_2 @ 0x7fbec8702480] [verbose] w:1280 h:720 flags:'bilinear' interl:0
[Parsed_scale_4 @ 0x7fbec8702e40] [verbose] w:1280 h:720 flags:'bilinear' interl:0
[fatal] Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_pad_5
[AVIOContext @ 0x7fbec862bfc0] [verbose] Statistics: 104366 bytes read, 2 seeks
[AVIOContext @ 0x7fbec870a100] [verbose] Statistics: 32768 bytes read, 0 seeks
[AVIOContext @ 0x7fbec87135c0] [verbose] Statistics: 460284 bytes read, 2 seeks
我不知道Parsed_pad_5
是什么意思。我用Google搜索Cannot find a matching stream for unlabeled input pad
并发现在任何地方都没有任何解释。我是相对的ffmpeg新手。在我开始扎根源代码之前,有人能指出我正确的方向吗?预先感谢。
答案 0 :(得分:0)
将带有逗号的过滤器连接到线性链中时,无需提供标签。因此,将increase[v0],pad
更改为increase,pad
,并对其他两个实例执行相同的操作。