Web Performance 101
Web Performance 101
Video content engages users, and doesn't have to impact your page's performance. These techniques will ensure your video content is optimized.
Join the DZone community and get the full member experience.Join For Free
xMatters delivers integration-driven collaboration that relays data between systems, while engaging the right people to proactively resolve issues. Read the Monitoring in a Connected Enterprise whitepaper and learn about 3 tools for resolving incidents quickly.
Web page content is a mix of rich HTML, images, videos, and other media types. Multimedia content can add significantly to the overall page size and directly affect web page performance. This doesn’t mean embedding videos is against best practices; all types of page content can be tuned to overcome any negative impact on performance. Optimizing a web page is a critical step in ensuring a satisfactory digital experience, and this process is incomplete if the video content is overlooked.
Video content boosts user experience and conversion rates. High-resolution videos are now a staple in web page design, and this translates to heavier web pages. There are a variety video formats available today with each format having its own set of specifications and limitations.
Some of the common types of video files used in web pages include WMV, FLV, MOV, WebM, and MP4. MP4 and WebM are the most popular formats and is used across different video sharing platforms like YouTube and Vimeo as the video quality is better than other file types. Another advantage of using MP4 and WebM files is that the size is relatively smaller and it is supported by most browsers.
If you aim to deliver the best digital experience without compromising on rich multi-media content on your website, then there are two main aspects to consider:
- Optimizing the video content to provide high-quality video with minimum impact to page speed.
- Optimizing the page design to embed and display multi-media content and boost the user experience.
Optimizing Video Content
Videos don’t necessarily have to be an impediment to improved web page performance; there are several ways to tune the media content in a page to complement the page performance. Here are some of how you can optimize video files:
The most basic step in optimizing video is cutting down the file size to make it easier to download and play. A video’s file size depends on the bit rate and other metadata attached to it. Data compression is one of the techniques that can be used to reduce the video file size without losing the video quality. ffMpeg, HandBrake, and MpegStreamclip are some of the compression tools available. These tools restructure the way the pixel data is stored to make the final video optimized and lighter.
File Format– Converting to HTML5 Videos
The file format can also contribute to the video file size; Different video file types store data in different ways which is why a WebM video is lighter than an MP4 video. In addition to the bytes a video file adds to the page, we should also consider browser support; browsers may support only a few of the available formats and this makes it important to ensure you are not embedding videos on your page that requires extra plugins.
Modern browsers support HTML 5 video formats like MP4, WebM and Ogg Video. So, it is recommended to convert the videos to one of these formats to make it easier to optimize and embed n webpages.
CDNs can be used to stream video content so that it is available to the user instantaneously; The user need not wait for the video to download and buffer. OVPs or Online Video Platform providers offer services that handles video optimization to provide the user with seamless video streaming.
CDN’s employ different caching techniques to ensure the requested media is delivered quickly and it is common practice for CDNs to cache popular video content. The infrastructure and geographical coverage provided by CDNs makes it possible for users to access videos from any device and from any location without compromising the video quality or webpage performance.
Traditionally media files were downloaded or copied to the user’s system before playback; this usually resulted in latency and loss of quality. Streaming was introduced to directly “stream” media content from a server to a media player on the browser.
Several new technologies make use of Adaptive Bitrate Streaming over HTTP to enable streaming; some of these include MPEG-DASH, HTTP Live Streaming (HLS), and HTTP Dynamic Streaming (HDS). All these protocols are designed to stream videos from a regular HTTP server making specialized media delivery servers redundant. The video stream is broken into smaller chunks of different bitrates that are ready for playback; a device trying to view the video file can pick the data stream as needed based on the bandwidth available.
Optimizing Page Design for Video
In addition to the format and data delivery of the video content, it is also important to optimize the web page design so that it doesn’t hinder the user experience. Here are some points to consider when designing your website:
Optimizing for Mobile Devices
The video content on a page must be optimized for mobile devices as the display resolution and size vary across different mobile devices. The video must adjust along with the responsive design of the website; it should also detect the device orientation and display the video accordingly.
Video Size and Placement
The size of the video embedded on the page is as important as the video format and file size. Using HTML or CSS to specify the exact width and height of the embedded video allows the browser to allocate the required bandwidth and avoid unnecessary overhead.
Embedded videos that are configured to auto-play requires the page to make additional requests for files and resources needed for video playback, this can slow down the page significantly. Deferring videos from loading till after the initial page load has completed frees up bandwidth, allowing the page to load faster.
To Embed or Not to Embed
Website designs are more creative and fluid than ever. Multimedia content has become a necessity in engaging users and can improve conversion rates on your website. It also provides a unique digital experience. So, there are more reasons to embed videos on your web page than there are disadvantages. There is no cost to performance if we optimize the page design, pick the right video format, and utilize media delivery providers to handle video processing efficiently.
Published at DZone with permission of Kameerath Kareem , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.