Partially adapted from the ffmpeg formula. libav compilation seems robust, I
tested on two laptops and installed alongside ffmpeg without issue. I also
tested with all build options enabled.
Previous mention of a libav formula was at #12534.
Closes#20827.
Signed-off-by: Xiyue Deng <manphiz@gmail.com>