To add to the above... realize that most CDNs (Content Delivery Networks, ex YouTube) re-encode their videos for distribution. This process is well covered in YouTube, Facebook, etc respective technical blog articles.
So, realize that what you encode to, is used primarily for sending that content TO your CDN. It is usually NOT what viewers watch (which your post seems to mistakenly assume?)
So I do recommend _before_ contacting a lawyer that you do more research and actually understand the streaming content process workflow, recognizing that if you hosted your own Public Internet server and distributed the videos from there, that would be different than videos hosted elsewhere. As for why that is true, I'll leave that for you to research on your own, or ask a lawyer with specific knowledge on streaming
the above addresses encoded content format as you asked... but in most cases you are actually asking the wrong question, because
1. it appears to imply a misunderstanding on streaming delivery
2. your bigger concern should probably be the use of any copyright content (background music, images, video, etc).. none of which has ANYTHING to do with OBS Studio (or any other video compositing/editing software) in regards to streaming content, and is where streamers tend to have more 'problems'. Though again, this is a content creation application support forum.
Licensing, copyright, etc considerations as you are asking about is completely separate from the application... and there are plenty of YouTube videos on this exact subject - though like always, do your due diligence, it is not uncommon for streamers to fail to provide context for their content and provide wrong or misleading info as a result (ie fake 'news'/clickbait is everywhere)
And what are the rules... like most things... it depends (on a large number of factors including exact content, regulatory environment, etc... and none of which are OBS Studio specific). Your streaming platforms of choice may have discussion forums more applicable to your questions