ffmpeg -y -i video.mp4 -i overlay.png
-map "[v]" -map 0:a? -ac 2 output.mp4
scale2ref scales the first input (to the filter) to the size of the second. The input pad indexes
1 refer to the first and 2nd input to FFmpeg, as that count begins from zero.
-map 0:a? – the
? tells FFmpeg to map the audio contingently i.e. if present. I have removed the
amix since a) filters within a filter complex can’t be contingent and b) there’s only one input so there’s nothing to ‘mix’.