If you want hardware decoding, first check what your gpu actually supports. vainfo
can be used on Linux for example.
If you have a very new gpu, it might support av1 decoding. This is currently the best codec and alsi free.
Otherwise I'd prefer hevc and then avc, in that order. Vp8 or vp9 might also be supported, but they never caught on much so encoders and decoders are generally worse for them than the equivalents for other codecs.
I don't know any private person who was prosecuted for using hevc or avc. Most likely your hardware manufacturer and other companies already paid for the license to use hevc/avc. If you live in the EU it's even less of a problem as software patents are not a thing here, i.e. you can't patent a way to do things.
Foe audio opus is the best codec at the momenr.
Please make sure to compare the quality before and after decoding. Even using a more efficient codec I'd be wary of a 300mb sized movie.
Totally agreed, but you'd still want gpu decoding.