与ffmpeg合并两个文件时出现异常 [英] Getting Exception while merging two file with ffmpeg

查看:313
本文介绍了与ffmpeg合并两个文件时出现异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ffmpeg命令合并两个mp4文件.我的输入文件不是采用相同的编码,因此它们不会与普通命令合并.我使用下面的命令,但有异常. 命令:-

I am trying to merge two mp4 files using ffmpeg command. My input files are not in same encoding so they are not merge with normal command. I have use below command but got exception. Command: -

ffmpeg -i File_1.mp4 -i File_2.mp4 -filter_complex "[0:v]setsar=1[0v];[1:v]scale=720:576:force_original_aspect_ratio=decrease,setsar=1,pad=720:576:(ow-iw)/2:(oh-ih)/2[1v];[0v][0:a][1v][1:a]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -c:v libx264 -crf 23 ffmpeg1.mp4

我遇到的异常:-

[Parsed_concat_4 @ 00000000067ea380] Input link in1:v0 parameters (size 720x576, SAR 1:1) do not match the corresponding
output link in0:v0 parameters (320x240, SAR 1:1)
[Parsed_concat_4 @ 00000000067ea380] Failed to configure output pad on 
Parsed_concat_4
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
Conversion failed!

请告诉我该命令的解决方案是什么,或者可以帮助我使用cmd在Windows中合并任何两个mp4文件的命令.

Please tell me what is the solution for that or any command which can help me out with merge any two mp4 file in windows using cmd.

推荐答案

concat过滤器要求其所有视频输入具有相同的分辨率和采样宽高比.帧速率和像素格式可能会有所不同,尽管输出可能不是您想要的.

The concat filter requires all its video inputs to have the same resolution and sample aspect ratio. The framerate and pixel format can differ, though the output may not be what you want.

因此,在此命令中,更改第一个视频输入的过滤条件以匹配第二个视频输入.

So, in this command, alter the filtering of the first video input to match the second.

ffmpeg -i File_1.mp4 -i File_2.mp4 -filter_complex "[0:v]scale=720:576:force_original_aspect_ratio=decrease,setsar=1,pad=720:576:(ow-iw)/2:(oh-ih)/2[0v];[1:v]scale=720:576:force_original_aspect_ratio=decrease,setsar=1,pad=720:576:(ow-iw)/2:(oh-ih)/2[1v];[0v][0:a][1v][1:a]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -c:v libx264 -crf 23 ffmpeg1.mp4

这篇关于与ffmpeg合并两个文件时出现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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