I've two files, a mp4
and a mp3
file. I want to add a 3
seconds intro screen with title Welcome
and black
background to the head of the video with the mp3
as background. So here's what I wrote.
ffmpeg \
-i input.mp4 \
-i bgm.mp3 \
-f lavfi -i color=c=black:s="1280"x"544":d=3.0 \
-filter_complex \
"[2:v]
drawtext=
fontsize=30
:fontcolor=white
:x=(w-text_w)/2
:y=(h-text_h)/2
:text='WELCOME'
[introVideo];
[1:a]
atrim=0.0:3.0
[introAudio];
[introVideo][introAudio][0:v][0:a]concat=n=2:v=1:a=1" -preset superfast output.mp4
but am getting below error when I try to execute the command
[Parsed_concat_3 @ 0x55c02756fa00] Input link in1:v0 parameters (size 1280x544, SAR 1299:1280) do not match the corresponding output link in0:v0 parameters (1280x544, SAR 1:1)
[Parsed_concat_3 @ 0x55c02756fa00] Failed to configure output pad on Parsed_concat_3
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:1
Conversion failed!
Any help will be highly appreciated.
PS: I am a beginner in video processing and ffmpeg
.
unsafe
flag seems not recommended. Is it possible to set the aspect ratio of input video to-f lavfi -i color...
?[0:v]setsar=1[0v];
before the concat filter, and use label0v
in place of0:v
in concat.sar
ofinput
but want to changesar
of[2:v]
tosar
of0:v
?