FFmpeg filter_complex concat仅在裁剪时提供第一个输入 [英] FFmpeg filter_complex concat gives only first input on crop

查看:206
本文介绍了FFmpeg filter_complex concat仅在裁剪时提供第一个输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用concat和crop具有多个输入和多个输出时,我遇到了麻烦。

I've encoutered problem when using concat and crop with multiple inputs and multiple outputs. Here's

ffmpeg -y \
-i input_1.mp4 \
-i input_2.mp4 \
-i input_3.mp4 \
-i input_4.mp4 \
-filter_complex "[0:v][1:v][2:v][3:v]concat=n=4:v=1:a=0[v];\
[v]crop=3840:1080:960:0[center];\
[v]crop=960:1080:0:0[left];\
[v]crop=960:1080:4800:0[right]" \
-map "[center]" -c:v libx264 -preset faster -b:v 20000k -an -pix_fmt yuv420p -tune zerolatency -tune fastdecode "Output_Center.mp4" \
-map "[left]" -c:v libx264 -preset faster -b:v 20000k -an -pix_fmt yuv420p -tune zerolatency -tune fastdecode "Output_Left.mp4" \
-map "[right]" -c:v libx264 -preset faster -b:v 20000k -an -pix_fmt yuv420p -tune zerolatency -tune fastdecode "Output_Right.mp4"

所以我将4个输入连接成1个流[v ],然后将某些部分裁剪到[center],[left]和[right]

So there I concatenate 4 inputs into 1 stream [v], then I crop certain parts to [center], [left] and [right]

对于第一个输出(中心),它按预期工作,输出视频持续时间正确(1 + 2 + 3 + 4输入durati ons),但对于左输出和右输出,持续时间与第一个输入的持续时间完全匹配。

For first output (center) it works as expected, output video duration is right (1 + 2 + 3 + 4 input durations), but for left and right outputs duration completely match duration of the first input.

我也尝试使用[v1]作为concat的输出,但并没有t help

I've also tried use [v1] as output of concat, that didn't help

推荐答案

中间的滤垫输出无法重复使用。要进行多次使用,请为输出添加带有不同标签的split,即

Intermediate filter pad outputs can't be reused. For multiple use, add split with different labels for the outputs i.e.

-filter_complex "[0:v][1:v][2:v][3:v]concat=n=4:v=1:a=0,split=3[v1][v2][v3];\
[v1]crop=3840:1080:960:0[center];\
[v2]crop=960:1080:0:0[left];\
[v3]crop=960:1080:4800:0[right]" \

这篇关于FFmpeg filter_complex concat仅在裁剪时提供第一个输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆