Optimal Format for Video on Webpage

I am working on a website that demos an app, and am trying to embed a simple preview of the app in the hero banner at the top of the page. Currently I have the preview as an mp4 recording of the app in a simulated iPhone, but that format lacks transparency so there is an ugly white rectangle around the video. I've heard that mp4s are not the most efficient format to use on the web, so I'm curious what the optimal format is. Should I try to convert it as a gif, even though the demo wouldn't look as nice? What formats would accomplish the purpose and load efficiently?