You could "pre-convert" convert them using Handbrake. This Programm uses your graphics card to transcode the media into a playable format like mp4 for example. Then your tv doesn't have to do anything other than just play the stream.
Jellyfin: The Free Software Media System
Current stable release: 10.10.0
Matrix (General Information & Help)
Matrix (Off-Topic) - Come get to know the team and blow off steam!
Matrix Space - List of all the available rooms on Matrix.
Discord - Bridged to our Matrix rooms
Handbrake would be a great tool for this. Another application that could work is tdarr, which is better at storing different transcoding parameters per directory.
I would use ffmpeg for this but I am not very familiar with handbrake. ffmpeg runs in a terminal so you may not want it if you don't like that.
I'm comfortable in a terminal but I'd prefer that I didn't have to do it manually, just set it in a configuration file somewhere and have it happen automatically.
I just went through a similar struggle. A large portion of my media wouldn't play properly on my TV or through a browser. I had considered re-encoding everything, but out of a 20TB library, assuming half of the media would need transcoding, that's a long time re-encoding media.
Ultimately, I upgraded the GPU in my Jellyfin server. Now I have no issues transcoding 4k streams on-the-fly and plenty of GPU overhead left for multiple streams if I need it. If it's in your budget, a GPU is a great way to go. My old Quadro P400 (I think it was $80 brand new a year or two ago) worked great for 1 or 2 4k streams as long as I disabled tone-mapping. My new RTX A2000 ($250 used) can transcode and tone-map a single 4k stream with tons of resources to spare.
If you look in my post history, I have a recent thread specifically about this.
I use Unmanic, but there's also Tdarr.