Search code examples
ffmpegsplash-screen

Adding splash screen using FFMPEG


everyone!

I'm trying to add a splash screen to fade out after 2 seconds into a video using FFMPEG.

I'm using the following command:

ffmpeg -loop 1 -framerate 2 -t 2 -i image.png \
   -i video.mp4 \
   -filter_complex "[0:v]fade=t=in:st=0:d=0.500000,fade=t=out:st=4.500000:d=0.500000,setsar=1; \
   [0:0] [1:0] concat=n=2:v=1:a=0" \
   -c:v libx264 -crf 23 output.mp4

but it is generating a video whose duration is correct, but plays for just 2 seconds, exactly the splash screen duration.

Since I don't have very experience on FFMPEG and got this code from the internet I don't know where the problem is...


Solution

  • Use

    ffmpeg -i video.mp4 -loop 1 -t 2 -i image.png \
          -filter_complex \
    "[1]fade=t=in:st=0:d=0.500000,fade=t=out:st=1.500000:d=0.500000,setsar=1[i]; \
     [i][0]concat=n=2:v=1:a=0" \
     -c:v libx264 -crf 23 output.mp4
    

    The image should be the same resolution as the video. It will fade-in for 0.5 seconds, remain for 1 second, then fade out for 0.5 seconds.