Some licenses, like LGPL, have provisions for this, some just forbid it.
In the specific ffmpeg case, you are allowed to dynamically link against it from a project with an incompatible license.