Video Loading Guide
Video Loading - What you need to know
There are a number of different factors that determine how fast a remote video can be rendered and displayed in a web browser.
Since these factors are outside of Encord's ability to influence, but may affect the user experience within the Encord platform, we wanted to take the time to document the causes of video latency and buffering issues, and the best practices to ensure the best possible experience.
What the causes of latency might be and how to troubleshoot them
Latency (slowness) when rendering remote videos in the browser can be caused or increased by:
- Local connection speed
- Geographical distance from the remote location where the video is stored
- Use of a Virtual Private Network (VPN) which route traffic via one or more additional locations
- Firewalls with enhanced scanning that may throttle connection speed
- The bitrate of the video file being requested
Local connection speed
In the label editor within Encord's platform, you will see an indicator at the bottom of the editor pane, which shows the speed at which you are downloading the current video, as well as the speed needed to download it to avoid pausing for buffering.
Geographical distance from host bucket
Videos load fastest when the data travels as short a distance as possible.
Naturally, the further you are from the storage location, the further the data will have to travel before reaching you, and the greater the probability that it gets throttled in the process.
The more hops geographically that the data needs to make before it gets to you, the slower it will typically be.
VPN's route inbound traffic in ways that imply at least one additional hop.
Commercial VPN services tend to be relatively performant, but self-hosted corporate ones can vary in terms of reliability and speed.
Slow local connection
Typically, you pay your internet service provider an amount that corresponds with the performance requirements you have.
If you're regularly streaming videos from remote locations, take this account when purchasing or upgrading your internet package.
Video content itself varies widely in terms of
definition and size.
The most important factor when determining how quickly a remote video will load in the browser is the
The higher the bitrate, the more data will need to be loaded per second of video.
Higher bitrates mean a higher probability of hitting buffering or latency issues.
It's important to stress that this is not a function of the Encord platform, but rather a fact about how video rendering works on the internet at scale.
So why do YouTube videos load fine for me?
Video streaming services such as YouTube and Netflix use a number of advanced performance optimisations to deliver your content including the use of a Content Delivery Network to perform caching of commonly loaded content and ensure loading occurs from the geographically nearest location (sometimes referred to as The Edge).
They also intelligently adjust the quality (
bitrate) of the video being served to appropriately match the local connection in order to minimise or prevent pausing whilst buffering.
What options are available to the customer to improve loading e.g. caching, transfer acceleration etc
Different Cloud Storage providers provide different solutions to improve the speed at which data can be served and rendered to end users.
These generally fall into three categories:
- Caching services to ensure content is loaded once and available more easily thereafter
- Geographical optimisations such as ensuring the content is being served from the most appropriate location
- Transfer accelerations to ensure the speed at which the data is sent is as fast as it can be
Per service, these look like:
- Cloudfront CDN - content delivery network - caches regularly loaded items and ensures loading takes place at The Edge
- Multi-Region - ensures your S3 bucket content is replicated in the regions where it needs to be served, reducing the distance the data has to travel
- Transfer Acceleration - uses AWS's high speed internal network to move the data to the nearest AWS location from which it can be served to the client with minimal latency
Steps to optimise your video loading speed:
The following pathways are available to you when trying to optimise video loading speed.
The tradeoff here is that you need to decide which is more important in your context; maintaining the original content and encoding, or keeping cloud infrastructure costs down.
In general, if you need the highest possible video quality, you should optimise your cloud infrastructure to support this, whereas if you can tolerate a slightly lower video quality, you may choose to modify the videos themselves.
Regardless of what your use-case is, it is important to use the remote storage location closest to your end users where at all possible.
Optimise your infrastructure:
- Use an S3 bucket region, Azure container, or GCP bucket closest to the geographic location where the videos will be loaded by the end users of the Encord platform.
- If multiple, disparate regions are going to be requesting the data, e.g. users in India and Europe will be requesting the data, use multi-region to ensure the data is replicated in the region(s) nearest to where the end users will be requesting it
- Consider using a content delivery network offered by your cloud provider to ensure videos are cached and loaded from the most appropriate location
- Consider enabling Transfer Acceleration, which sends the remote content via your cloud provider's high speed internal network to the location nearest the end user to reduce latency
- If appropriate and possible in your context, turn off any VPN when using the Encord platform
Optimise your remote content:
- Down-sample your videos with
ffmpegor another open source tool
- Re-encode your videos if they have been insufficiently compressed - again you can use
ffmpegto do so