[英]How to concatenate 2 video files using FFmpeg?
我有兩個視頻文件intro.mp4
和video.mp4
,我想要它以便intro.mp4
附加到video.mp4
我嘗試使用此處給出的解決方案來執行此ffmpeg -i intro.mp4 -i new.mp4 -filter_complex "[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" outputt.mp4
但我得到了這個錯誤
[Parsed_concat_0 @ 0x555ded10a180] Input link in0:v0 parameters (size 1920x1080, SAR 1:1) do not match the corresponding output link in0:v0 parameters (567x400, SAR 1:1)
[Parsed_concat_0 @ 0x555ded10a180] 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
對於 CMD:
ffmpeg -i "concat:intro.mp4|video.mp4" -codec copy output.mp4
對於批處理(您需要將輸入文件放在“inputs”文件夾中,與 FFmpeg 位於同一目錄中。您的 output 文件將位於“outputs”文件夾中。):
@echo off
mkdir inputs
mkdir outputs
:Begin
echo.
set /P iformat=Insert the format of the input files:
echo.
set /P input1=Insert the name of the first input:
echo.
set /P input2=Insert the name of the second input:
echo.
set /P output=Insert the name and format of the output (e.g. output.mp4):
for %%i in (inputs/*%iformat%) do (
echo file 'inputs/%input1%.%iformat%' > concatlist.txt
echo file 'inputs/%input2%.%iformat%' >> concatlist.txt
ffmpeg -y -f concat -i concatlist.txt -c copy outputs\%output%
)
del concatlist.txt
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.