简体   繁体   English

如何使用 ffmpeg 将多个不同分辨率的 MP4 视频连接在一起?

[英]How can I use ffmpeg to join multiple MP4 videos together that are various resolutions?

I'm trying to use FFmpeg to join together multiple MP4 videos, however, the videos are all different resolutions (width, height) and FFmpeg keeps throwing errors when trying to concatenate the clips.我正在尝试使用 FFmpeg 将多个 MP4 视频连接在一起,但是,这些视频都是不同的分辨率(宽度、高度),并且 FFmpeg 在尝试连接剪辑时不断抛出错误。

Im using this command to try and concatenate the clips:我使用此命令尝试连接剪辑:

ffmpeg -i [PATH TO 1ST CLIP] -i [PATH TO 2ND CLIP] \-filter_complex "[0:v] [0:a] [1:v] [1:a] \concat=n=2:v=1:a=1 [v] [a]" -map "[v]" \-map "[a]" [OUTPUT PATH]

But when I run this command I get the following errors:但是当我运行这个命令时,我得到以下错误:

[Parsed_concat_0 @ 0x7fd6a1d09340] Input link in1:v0 parameters (size 1242x1030, SAR 1:1) do not match the corresponding output link in0:v0 parameters (1124x1142, SAR 1:1)
[Parsed_concat_0 @ 0x7fd6a1d09340] Failed to configure output pad on Parsed_concat_0
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
Conversion failed!

Does anyone know what command I should use to join these clips together?有谁知道我应该使用什么命令将这些剪辑连接在一起?

You cannot join any 2 videos with different resolutions, at least not with ffmpeg .不能加入任何 2 个具有不同分辨率的视频,至少不能加入ffmpeg It's mentioned explicitly in the ffmpeg concat docs that you will have to do it manually before concatenation.ffmpeg concat文档中明确提到,您必须在连接之前手动执行此操作。 Src: https://ffmpeg.org/ffmpeg-filters.html#concat来源: https://ffmpeg.org/ffmpeg-filters.html#concat

All corresponding streams must have the same parameters in all segments;所有对应的流必须在所有段中具有相同的参数; the filtering system will automatically select a common pixel format for video streams, and a common sample format, sample rate and channel layout for audio streams, but other settings, such as resolution, must be converted explicitly by the user.过滤系统将自动 select 视频流的通用像素格式,音频流的通用采样格式、采样率和通道布局,但其他设置,例如分辨率,必须由用户显式转换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM