To be clear, the message is actually:
libavcodec may be vulnerable or is not supported
Depending on the version of libavcodec you have, it may well be unpatched against some vulnerability, or it could just be that it is old enough that it's just incompatible with Firefox (and maybe it's vulnerable too...)
Firefox is doing some version check of the libavcodec you have installed, looks for certain versions and shows the message if you have too old a version. Specifically, they recently:
Blocked versions of libavcodec older than 54.35.1
(I guess in future, as the message states, they may well blacklist recent versions if they're missing security patches. Anyway, here, they've just gone for versions of a certain age.)
To get back to answering your question, if you're installing a more recent version from a PPA (which is libavcodec56 from the linked answer) then Firefox will see that newer version installed and use that version for decoding media, and not the older libavcodec54. (Note that this package's files have the version number in the filename, so you could well have both newer and older versions of it installed side-by-side.)[1]
Installing a newer libavcodec therefore won't magically fix any vulnerability in your existing installed version — of course, that will persist until you remove it — but it means that Firefox can use a version of the library that isn't vulnerable (which is what the Firefox developers care about).
[1]: Additionally, looking at my 16.04 install, libavcodec-ffmpeg.so.56 is actually a symbolic link to a particular file, so that's another way in which you could have multiple versions installed side-by-side, even of the same major version of libavcodec, but only one specifically being used.