So basically where it counts (x264 and x265), I can't.
LATER EDIT:
I remember looking into this a while ago in quite a bit of detail: https://www.engadget.com/2010-05-04-know-your-rights-h-264-p... (there's plenty of other links to this).
Long story short, MPEG LA owns some patents that relate to h264/h265, and you need to pay them A LOT of $ in order to use these codecs. Using ffmpeg will not devoid you of that.
Also, even somewhere on the ffmpeg page, when I last read it, it will say something more in the lines of "we're not lawyers, so take this with a grain of salt".
----------
So all in all, after doing quite a bit of research, seeing how vague the licensing from MPEGLA is and all that, I started looking for alternatives. I found one (from Microsoft), and that's what I'm using. At this point, it satisfies most of my needs (even though I had to do lot of optimizations on top of it) -- in case this won't hold true in the future, I may revisit the whole ffmpeg mambo-jambo :D