both of those CPUs should be able to do 4k video just fine, in software mode and hardware mode with the integrated GPU. i believe you would be restricted to 4k @ 30hz, which is fine for movies and such. Most people say use hardware mode because you end up with almost no CPU usage, which is true, but that is not always ideal. If you do not have an HDR display and play HDR movies, the color conversion done in hardware mode will cause severe banding and look terrible (it made Blue Planet II almost completely unwatchable, for example). I ran into this on my own setup. Software decoding solved that issue. If you have an HDR display then there'll be no conversion and no issue.
TL: DR - both CPUs should handle 4k just fine. up to 30hz if using the Intel UHD, or 60 hz if going through a dedicated GPU.
Edit: let me add: if you have an HDR display, any modern CPU can do 4k. I have a machine with a Celeron G3930 dual core that does 4k HDR without issue through its Intel UHD GPU, up to 30 hz.