Transcoding on-the-fly is a CPU intensive thing. It is beyond what a r-pi can accomplish. You'll need another box on the network somewhere, probably an Intel Pentium or faster. The G3258 CPU is cheap and capable for this task. It isn't an i7, so don't expect transcoding to be faster than real-time, but it does work. Built a plex server for about $120 with this CPU and some old parts laying around. The machine is a storage server, media server, ebook server, vpn server and a few other servers running.
Another r-pi running OSMC/Kodi would be cheaper than adding another PC. Also, since we don't have Windows here, the BubbleUPnP server is paid and Windows. There are other methods to do this - use chrome browser (or chromium-browser) with a Cast-To chromecast option.
OTOH, Plex Media Server can do on-the-fly transcoding for different client DLNA devices, as needed. It works. There are different profiles for each client devices which tells plex what and how to transcode for a specific client. I use Plex as the center of my media with different clients near the playback locations - Roku, OSMC, Chromecast. For the chromecast, I use either BubbleUPnP to stream from plex or castnow (a complex node.js project) to push a pre-transcoded-for-chromecast file.
Honestly, I've found little use for our chromecast. We have netflix for snail-mail, but not streaming. The chromecast doesn't stream for the service we use. Needed the roku for that, which has a nice remote and reasonable support for Plex.
I tried miniDLNA a few years ago. At the time, it didn't do lots of things I needed. Plex isn't perfect and I don't have a plex account nor do I pay them anything, but today, in a multi-viewing house, I really think they have the easiest, best, solution for the back-end. Nothing compares to Kodi/OSMC for the front-end, IMHO.
Happy new year!