Adding blurred background to portrait videos with ffmpeg
Limit the color output to a few frames. In the first overlay, it will repeat the last frame of the color once that stream ends. So,   color=black@.3:size=720x405:d=1[dark];



Filters can't be executed conditionally, so you will need to probe the input in a separate command beforehand and then execute a command with the filters or one without.

The command below

ffprobe in.mp4 -show_entries stream=display_aspect_ratio -of compact=p=0:nk=1 -v 0


will produce an output like this:

16:9


Just wrap a script to check that value.