0

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.

10
  • See 2nd command in answer at duplicate link.
    – Gyan
    Mar 1, 2020 at 13:58
  • @Gyan: running concat with unsafe flag seems not recommended. Is it possible to set the aspect ratio of input video to -f lavfi -i color... ? Mar 1, 2020 at 18:12
  • Insert [0:v]setsar=1[0v]; before the concat filter, and use label 0v in place of 0:v in concat.
    – Gyan
    Mar 1, 2020 at 18:33
  • Oh my god, it worked. One more doubt @Gyan. What If I don't want to change sar of input but want to change sar of [2:v] to sar of 0:v ? Mar 1, 2020 at 18:41
  • Then insert setsar for 2v after the final filter (geq).
    – Gyan
    Mar 1, 2020 at 18:48

0

Browse other questions tagged or ask your own question.