FFmpeg-concat视频错误,与相应的输出链接不匹配? [英] FFmpeg - concat videos error, do not match the corresponding output link?

查看:117
本文介绍了FFmpeg-concat视频错误,与相应的输出链接不匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ffmpeg将一些视频合并为一个视频.

I'm trying to concat some video into one single video using ffmpeg.

输入信息:

a.mp4 1920x808,b.mkv 1280x720

a.mp4 1920x808 , b.mkv 1280x720

首先,我在下面尝试了命令,它运行正常:

First I tried command below and it works fine:

ffmpeg -i a.mp4 -i b.mkv -f lavfi -t 0.1 -i anullsrc -filter_complex [1:v] scale = 1920:808:force_original_aspect_ratio = recrease,pad = 1920:808:(ow-iw )/2:(oh-ih)/2 [v1]; [0:v] [0:a] [v1] [1:a] concat = n = 2:v = 1:a = 1 [outv] [outa] -map [outv] -map [outa] -vcodec libx264 -crf 27-预设超快速-threads 2 out.mp4

ffmpeg -i a.mp4 -i b.mkv -f lavfi -t 0.1 -i anullsrc -filter_complex [1:v]scale=1920:808:force_original_aspect_ratio=decrease,pad=1920:808:(ow-iw)/2:(oh-ih)/2[v1]; [0:v][0:a][v1][1:a]concat=n=2:v=1:a=1[outv][outa] -map [outv] -map [outa] -vcodec libx264 -crf 27 -preset ultrafast -threads 2 out.mp4

然后我首先输入'b.mkv':

And then I put 'b.mkv' first:

ffmpeg -i b.mkv -i a.mp4 -f lavfi -t 0.1 -i anullsrc -filter_complex [0:v] scale = 1920:808:force_original_aspect_ratio = decrease,pad = 1920:808:(ow-iw )/2:(oh-ih)/2 [v0]; [v0] [0:a] [1:v] [1:a] concat = n = 2:v = 1:a = 1 [outv] [outa] -map [outv] -map [outa] -vcodec libx264 -crf 27-预设超快速-threads 2 out.mp4

ffmpeg -i b.mkv -i a.mp4 -f lavfi -t 0.1 -i anullsrc -filter_complex [0:v]scale=1920:808:force_original_aspect_ratio=decrease,pad=1920:808:(ow-iw)/2:(oh-ih)/2[v0]; [v0][0:a][1:v][1:a]concat=n=2:v=1:a=1[outv][outa] -map [outv] -map [outa] -vcodec libx264 -crf 27 -preset ultrafast -threads 2 out.mp4

但是这次我得到了错误:

but this time I got error:

输入链接in1:v0参数(大小为1920x808,SAR 0:1)与相应的输出链接in0:v0参数(1920x808,SAR 3232:3231)不匹配

Input link in1:v0 parameters (size 1920x808, SAR 0:1) do not match the corresponding output link in0:v0 parameters (1920x808, SAR 3232:3231)

我不明白为什么?

有任何想法吗?

非常感谢.

推荐答案

concat过滤器要求所有段都具有相同的属性,包括长宽比.您可以告诉过滤器将其忽略

The concat filters require all segments to have the same properties, including aspect ratio. You can tell the filter to ignore that

concat=n=2:v=1:a=1:unsafe=1(不推荐)

或为两个视频流设置相同的长宽比,

or set same aspect ratio for both video streams,

ffmpeg -i b.mkv -i a.mp4
-f lavfi -t 0.1 -i anullsrc
-filter_complex
[0:v]scale=1920:808:force_original_aspect_ratio=decrease,pad=1920:808:(ow-iw)/2:(oh-ih)/2,setsar=1[v0];
[1:v]setsar=1[v1];[v0][0:a][v1][1:a]concat=n=2:v=1:a=1[outv][outa]
-map [outv] -map [outa] -vcodec libx264 -crf 27
-preset ultrafast -threads 2 out.mp4

这篇关于FFmpeg-concat视频错误,与相应的输出链接不匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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