-1

I'm a new user of FFmpeg, and I want to insert a logo on two videos (one video overlay another) with one command.

  1. FFmpeg command (ok): enter image description here

    ffmpeg -stream_loop -1 -i background.mp4 -i input.mp4 -i logo.png -filter_complex "[1]scale=1280:720[inner];[0][inner]overlay=70:70:shortest=1[vid];[vid][2]overlay=10:10:enable='not(between(t\,10\,15))'[out]" -map "[out]" -c:a copy -y -shortest output.mp4
    
  2. I want to insert one (greenvideo.mp4) overlay another video Main and Background.

    enter image description here

  3. Video (greenvideo.mp4) and video (Background.mp4): Two videos are repeated by the main video length time.
    The green video over the background.

    ffmpeg -y -i input.mp4 -stream_loop -1 -i green.mp4 -filter_complex "[1:v]colorkey=0x00ff00:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" -map 0:a -shortest output.mp4
    

Please help me combine the above two code snippets into one?

4
  • What's the exact problem here? I'm not following your picture and what e.g. MC Green is. Formulate a question that asks specifically for the problematic aspect, "please help me?" is not a real question.
    – Destroy666
    Commented Jul 8, 2023 at 7:43
  • I want to combine 2 above code into 1. MC Green is the name of the video file Green.mp4
    – alexdo
    Commented Jul 8, 2023 at 8:18
  • Edit the question whenever you add more details. What did you attempt?
    – Destroy666
    Commented Jul 8, 2023 at 8:19
  • What research have you done and what have you tried? Commented Jul 16, 2023 at 3:20

1 Answer 1

2

You can apply the scale and colorkey filters before overlaying. You can then overlay multiple times, if required, in a single script. The basic concept is shown below.

ffmpeg -i background.mp4 -i mainvideo.mp4 -i greenvideo.mp4 -i logo.png -filter_complex /

[1]scale[SC];[2]colorkey[CK]; /

[0][SC]overlay[OVa];[OVa][CK]overlay[OVb];[OVb][3]overlay out.mp4


    
3
  • you are missing 1 input file greenvideo.mp4
    – alexdo
    Commented Jul 10, 2023 at 10:00
  • 1
    Your original question is a bit confusing. I now realise the "subscribe" image is your logo. Basic principle is the same, but I have updated my answer accordingly.
    – Sark
    Commented Jul 11, 2023 at 15:19
  • Thanks you @Sark
    – alexdo
    Commented Jul 12, 2023 at 11:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .