Video usage has peaked in recent years. If once marketers promoted images over textual content, today the outcry is for video. The assumption is that video content is easier to consume, and thus it’s the preferred medium of Internet users.
The problem with video is that it weighs a lot. A heavy file takes up a lot of storage space, which costs money to set up and/or maintain. A heavy file is also slow to load because it needs more computing power to transfer.
According to Cisco, 82% of consumer Internet will be comprised of video by 2022. This means the intake for storage, computing, and bandwidth resources will only grow. Video compression can solve this problem, partially. Below, you’ll find a few tips to get you started.
What Is Video Compression?
Video compression is the process of reducing the size of a video file. This is done through the conversion of the video file into a format that takes up less digital space. The conversion process is called encoding. You can encode videos by using a video codec.
A video codec is a device, software, or algorithm that encodes (converts one video format into another) and decodes (reverses the process by converting the video back to its original format) video files. At the end of the process, you will have a different video file format.
Video compression keeps your storage usage and subsequent costs at a minimum, and the loading time of your applications at a balanced maximum. The smaller the file, the less space it takes up, the less it costs, and the faster it can move (transfer) between digital spaces.
Video Compression Tips and Tricks
1. Keep your master files in a backup repository
Every time a video file is converted, it loses some of its original quality. To prevent quality degradation, you need to use a master/archival file for every video compression. The master is the original copy, which is usually of the highest quality and is therefore of the highest size. You keep the master safe in a backup repository, where it’s easily accessible to you. You don’t share a master file with others. Instead, you share a compressed version of the video.
2. Before compressing, ensure that the media player supports the container
A container, or wrapper, is a digital vessel that contains the data of your video, including the codec, video data and audio streams, video metadata, and subtitles. The container is like a glove that fits around the video, and it needs to fit the hand it protects (the video) and the weather conditions (the media player). Different media players support different containers, such as mp4, avi, and mkv. Before compressing, ask the recipient what file type they can use.
3. Use lossy compression if the quality isn’t a priority
There are two types of compression: lossy and lossless.
To compress video size with lossy compression, you reduce the components it contains. That means that every time you compress the video, you eliminate parts of it, such as a background that doesn’t seem necessary.
Lossy compression can reduce your video size significantly, but it’s irreversible. The more you use lossy compression, the lower the video quality you’ll end up with. Never do a lossy compression to masters.
4. Use lossless compression if the size isn’t a priority
Lossless compression, on the other hand, keeps all of the video data intact. Lossless compression algorithms search for temporal and spatial redundancies and eliminate them during the encoding process. In the end, you get a lower file size but retain the same quality.
To achieve lossless compression, you (or your system) will need to apply encoding algorithms that create statistical models and then use them to map out input data into bit sequences. A bit is a basic unit of information.
A bit rate determines how much information is packed into each second of your video. The higher the bit rate, the higher the video quality you will get. The use of arithmetic coding will get you the best possible compression rate. Huffman Coding will get you faster results, but of lesser quality.
Whichever algorithm is used, lossless compression always achieves a bigger file size than lossless compression. For lossless compression, the compression ratio is 8:1 max, whereas lossy compression can get to 300:1 for video, with very little perceptible quality loss.
5. Choose your compression standard wisely
Compression standards ensure that video codecs maintain compatibility with different applications and manufacturers. If the overall goal of video compression is to be able to share a video file with as little degradation as possible, the goal of compression standards is to ensure that the converted file is made to fit the recipient mediums.
Compression standards serve as the delivery file, taking into account the bandwidth of the transmission channel, and the memory of the recipient storage device. There are a number of video compression standards, each fits a different use case. Be sure to choose the one that fits your project best.
You can use the following video standards for lossy compression:
- Motion JPEG
- MPEG-1 Part 2
- MPEG-2 Part 2
- MPEG-4 Part 2
- H.264/MPEG-4 AVC (also applies to lossless compression)
- Ogg Theora
- Dirac
- Sorenson video codec
- VC-1
- H.265/HEVC
You can use the following ITU-T/ISO/IEC standards for lossless compression:
- H.264 lossless
- x264 (encoder only)
- FFmpeg (decoder only, uses x264 for encoding)
- H.265 lossless [29]
- x265 (encoder only)
- UHD code (decoder only, uses x265 to read HEVC encoded files) [30]
- FFmpeg (decoder only, uses x265 for encoding) [31] [32]
- Motion JPEG 2000 lossless
- libopenjpeg
It’s a Wrap!
Video compression can reduce the costs associated with video storage, transmission, and streaming, as well as improve loading times. You can do this manually, or you can use an automated system. However, always assess the compression system to ensure it fits your needs.
Go with lossy compression for the smallest possible video size, but remember that you won’t be able to reverse the process. So never use lossy compression for masters. If your goal is to preserve the quality of your video, opt for lossless conversion. Next, assess the devices and system the video will be used at, and then choose the appropriate container and standard.
Gilad David Maayan is a technology writer who has worked with over 150 technology companies including SAP, Samsung NEXT, NetApp and Imperva, producing technical and thought leadership content that elucidates technical solutions for developers and IT leadership.