Zend certified PHP/Magento developer

FFmpeg – How to replace the image of a video with a png without modifying the audio?

I’m trying to modify several videos as quickly as possible. The goal is to replace the original image of the videos with a black or white image, in short, an image with nothing.

Searching the internet I found two lines of code (both work):

ffmpeg -loop 1 -i x.png -i "y.mp4" -map 0 -map 1:a -c:v libx264 -crf 22 -preset slow -c:a copy -shortest out.mp4

ffmpeg -i x.png -i "y.mp4" -filter_complex "[1][0]scale2ref[i][v];[v][i]overlay" -c:a copy out.mp4

but which one to use? or rather what is the fastest way to do this without audio loss? Loss of video quality is not a problem as long as the minimum resolution is 426×240.