When you want to upload videos and use them on a website, it is important that you optimize them beforehand. The fact of the matter is that optimizing your videos is essential in order to ensure they are viewable, and can also affect other areas such as loading time.
Overall there are two areas in particular that you’ll want to pay close attention to when optimizing your videos for a website, and they are:
Video format and codec
To make sure that your video can be viewed by visitors, you need to choose a video format or codec that is widely supported by most browsers. In general the formats that are most popular tend to be MP4, FLV or WebM. In terms of codecs H.264 and VP8 or VP9 are frequently-used nowadays and although they are generally compatible with newer browsers, older ones may have difficulty handling them.
It is important to think about backwards compatibility when choosing a video format or codec, as a large portion of visitors to your website will likely be using older versions of certain browsers. As such the best practice is to use a newer codec (which likely has better compression) but also provide an alternative version of the same video that is more backwards compatible.
Although internet connection speeds have improved by leaps and bounds over the years, it is still important that you take into consideration the file size of your videos. In particular you don’t want it to be so large that it has buffering issues, or eats up a big chunk of any bandwidth limitations (particularly for users on mobile devices).
Naturally the file size will be influenced by the format and codec as that will affect the compression of the video. However it will also be affected by various other factors, such as the resolution, bitrate, frame rate, and so on. Altering these will result in a drop in quality, so it is important to find a balance between the file size and quality.