The capital V specifier as in '-c:V' is supposed to match only non-attached-pic video streams.
However, a user reported that apic streams were matched as well.
Confirmed by testing. Apparently a regression since before 3.4 (earliest ver I could test).
This happens because encoder selection occurs before stream dispositions are set.
Fixed by an initial assignment of disposition and retaining only the apic flag if present.
PR #24247
(cherry picked from commit 266fff15a0)