Cannot upgrade due to "libdav1d.so=7-64", a dependency of "ffmpeg" and "ffmpeg.4"."

The problem is not with “libdav1d.so” which comes from “dav1d”. “ffmpeg” package is broken.

I solved the problem by first downloading the ffmpeg-git and all the dependencies manually and the building it by : -

sudo pacman -Sy yay

after yay is installed, then download the dependencies you may miss like I did, even though it was fresh installation.
The dependencies you may miss are:-
amf-headers, avisynthplus, ffnvcodec-headers-git, ladspa, nasm, opencl-headers

Before installing the above dependencies you might need to install other important dependencies which are patch, pkgconf, gnutls, make, So first install these by:-

yay -Sy patch pkgconf gnutls make

Then install the ffmpeg-git dependencies

yay -Sy amf-headers avisynthplus ffnvcodec-headers-git ladspa nasm opencl-headers

after installation, try the below mentioned code and rebuild ffmpeg

cd Downloads
git clone https://aur.archlinux.org/ffmpeg-git.git && cd ffmpeg-git
makepkg -si