Optimizing short Videos (~10 sec.) in Size for embedding in website & app
The best thing for such a use case is creating diffrent files which get loaded in different scenarios.

Current recommendation is to use webm for web content, this container is not supported with all Browsers tho, so also include a .mp4 to switch too.

GIFs can be compressed quite nicely, but you need to keep in mind that GIFs are quite strict about colors.

You can go quite far by compressing with FFMPEG