Codec is one of the most used words in the world of information technology, which refers to two different terms. It is a technical term for compression or decompression operation. This term is also used for compressor/decompressor and encoding/decoding.
Codecs reduce the size of video or audio files through the processes of encoding and decoding (format conversion), compression, and decompression (removing unnecessary bits).
A codec is usually a tiny piece of code read by other software to do its job. Of course, a codec can also be a piece of hardware that has the task of converting analog images and sound to digital. The codec work is done in real-time, whether it is during video recording or playback.
Sometimes, the codec work is quite the opposite, and it has the task of converting the digital signal to analog. Hardware codecs are used mainly by engineers in audio and broadcasting, and software codecs convert video files into more convenient and smaller formats.
What Are the Uses of Codec?
A codec is a hardware or software-based process that compresses and decompresses data to reduce the volume of audio and video data exchanged over Internet platforms such as live streaming or video hosting platforms. This technique is advantageous in connection with conferences and video streams. The least amount of data should be sent or received through the communication channel with the best possible quality.
The second use of codecs is to convert data from one format to another. For example, in the multimedia world, Codecs receive the data of a video file and convert the data from one format to another, called encoding. On the opposite, decoding is where the data is converted from one format to another at the destination.
Codec receives the data of an input source and encodes them (format conversion), and performs the decoding process at the output so that a session can be carried out smoothly. To better understand what the Codec does, look at a simple example.
For example, when you create a video file in video editing software, you must pay attention to two essential things: file quality and file size. Video file editing software such as Adobe Premiere or Ulead Studio offer different outputs, some of which are for a specific application and playback on a particular device, and others can run on different platforms.
However, what all these options have in common is a concept called Codec. The Codec may be hardware or software. In both cases, Codec does data conversion and encapsulation for transmission over the network.
How Do Codecs Work?
Codecs use several complex compression algorithm methods. Some methods of data compression are easy to understand. For example, it is possible to store only the information related to the changes between one frame and the next frame. This method can nicely compress a few minutes of primarily static footage.
If the video shows a person who does not move much and is only talking and the image’s background is fixed, the video can also be compressed well. Naturally, other similar scenes can be compressed in the same way.
You can go one step further in video compression using the motion vector element and compensation algorithms. By benefiting from these two principles, it is possible to predict where a certain pixel will change in a frame played at other moments. As a result, the compression level is improved.
If the camera only moves vertically, the codec can tell you that a particular pixel is moving left or right after a few frames of the display.
Another compression technique is to group multiple pixels with the same color; Of course, low-quality videos will appear pixelated if this over-acceptable method of video compression is used. Also, in this method, the compressed video does not have enough information to decode and create the video in the same way as the uncompressed video.
In general, these compression methods and other methods can compress the video with high accuracy and are almost similar to the original video.
When compressing a video, parts of its data are removed, but since compression significantly reduces the size of the uncompressed video, it is welcome and even necessary. Different video compression methods are used when using different codecs, which are slightly different from each other. If new codecs are used, it is expected that the quality will not be sacrificed during the compression, and the quality will be maintained despite the reduction of the video size.
Why Is It Important to Use Different Codecs?
Using different codecs has made it easier to play and store videos on platforms, applications, and video streaming services on smartphones. To share a multimedia file on services like Twitter and Facebook, videos, music, and even pictures must be compressed to make them smaller.
In video streaming services like YouTube, the videos are encoded and loaded with several codecs so that every user can watch the video they are interested in with the quality they want, and all users with any device and any internet speed can watch YouTube videos online, entirely smoothly and without having trouble watching.
Although internet speed has improved significantly in recent years, sometimes it drops significantly, and Internet Service Provider (ISP) companies reduce the bandwidth of their subscribers. Therefore, it is necessary to use optimized codecs for such conditions.
Fortunately, new and efficient codecs have been created for video recording with the phone, making it possible to record high-quality and low-volume videos. Currently, many new Android phones use these formats to record videos. Nowadays, smartphone video recording is usually done with two common codecs, H.264 and H.265.
If you shoot a video in 4K mode for 20 seconds with your phone, the size of the H.264 video is about 125 MB, and the size of the H.265 video is about 90 MB. As you have seen, you can reduce the volume of the recorded video by 30% just by changing the codec.
It is interesting to know that if you use a processor with more power than a system on a phone chip, you can reduce the volume of the video even more.
Most Common Video Encoding Formats
It should be said that codecs are not only related to video formats but are also used in audio and sound. Raw and uncompressed audio and videos are very large, which makes it impossible to store, maintain and distribute them.
In the following, we will get to know several most used video codecs simply and briefly.
MPEG-2
MPEG-2 is one of the oldest video codecs still in use. This codec was very popular in the early 2000s. At that time, it was used exclusively for compressing TV shows and DVD movies. This codec was even used to compress the first high-quality Blu-ray movies.
Today almost no content is encoded with this codec, but currently, most devices support it; because many players today have backward compatibility technology.
H.264
Advanced Video Coding or AVC, also known as H.264, is one of the new video codecs. Most video player devices produced in the last 10 years support it. With the emergence of high-resolution videos, i.e., HD and Full HD videos, the popularity of this codec also increased; Because it used better and more efficient methods than before. The volume of H.264 videos is almost 50% smaller than MPEG 2.0. At the same time, they have similar and even higher quality than these videos.
The efficiency of H.264 is significantly better than previous codecs, which is why it quickly became the standard codec for HD content. At the same time, this codec made online video viewing possible for people who do not have access to the Internet with high bandwidth.
Using this codec, YouTube managed to stream 720p and 1080p content for the first time in 2008 and 2009, respectively. Over the next decade, the use of this codec increased for online content, HD Blu-ray movies, and TV shows.
As we said before, almost new player devices today support H.264, and even smartphones and professional cameras are filmed with this codec so that the videos recorded can be played on different devices without problems.
H.265
High-Efficiency Video Coding or HEVC means high-efficiency video coding, also known as H.265, and is the next generation of the H.264 codec. H.265 is much more efficient than previous codecs; because the volume of videos encoded with this codec is much smaller than other videos.
Therefore, this codec is considered very suitable for streaming content in video streaming services (because streaming such videos requires less bandwidth than other videos). It is also quite suitable for high-quality content.
With the advent of 4K TVs and 4K content, the use of H.265 increased significantly. The latest UHD content is encoded with this codec. At the same time, 4K and 8K smartphone recordings are also done with H.265, and HDR content such as Dolby Vision is also prepared with the same codec.
At the same time, well-known browsers such as Google Chrome and Mozilla Firefox do not support this codec.
VP9
The hesitancy of video player manufacturers and content production companies to use H265 prompted Google to create its own codec, VP9. This codec is about 30% more efficient than H.264, and its license is also free. Therefore, companies producing player devices do not have to pay Google if they want to use VP9.
Google decided to create and use such a codec when it wanted to efficiently encode and stream 4K content on YouTube. At the same time, Google asked Android TV manufacturers to add this codec to the codecs they support. These two factors made VP9 successful or at least more successful than H.265. Almost all smartphones and TVs released since 2017 and all browsers released since this year support this codec (VP9).
AV1
AV1 is considered the newest video codec, and the license of this codec is also free, like VP9. Also, more companies support this codec compared to VP9.
The development of AV1 was carried out under the supervision of the Alliance of Open Media consortium, which is a consortium of five technology giants, namely Google, Intel, Apple, Facebook, and Arm. This strong support for AV1 has made this codec more popular than HEVC and other similar codecs for video streaming.
Even though the design and creation of AV1 were finalized in 2019, until a few months ago, a hardware-accelerated device to decode this codec was not released on the market.
Therefore, the process of expanding its use is not fast at all. According to the estimates of Moscow State University experts, the speed of the development of this codec is 2,500 to 3,000 times lower than the speed of other similar codecs.
Undoubtedly, as AV1 becomes more common, more and more services will support it. YouTube and Netflix use this format to stream video on Android devices. Google has also started using this format. In addition, all popular browsers except Safari also support this codec.
Video Codes Comparison
Since your decision will be entirely based on your demands, there is no one best video codec. You’ve learned about some of them in this guide, and the following table will give you an overview of how they compare.
Codec | Type | License | FPS | First Published |
MPEG-2 | Lossy | Expired Patent | Up to 30 fps | 1995 |
H.264 | Lossy/Lossless | Patent Encumbered | Up to 59.94 fps | 2003 |
H.265 | Lossy/Lossless | Patent Encumbered | Up to 300 fps | 2013 |
VP9 | Lossy/Lossless | Patent Claims | Up to 60 fps | 2013 |
AV1 | Lossy/Lossless | Patent Claims | Up to 60 fps | 2018 |
Which Codecs Does Your Phone Support?
Smartphones, TVs, computers, and even game consoles support certain codecs, depending on their hardware. In other words, these devices can compel video files and decompress them in the best possible way using the hardware accelerator feature.
This issue is critical in smartphones; because the less processing pressure applied to the phone, the longer its battery life.
Sometimes videos don’t play with any app. In such cases, it is likely that the device you are trying to play the video with either does not support it or does not recognize the desired codec.
You can use the MediaInfo application if you do not know the video format you want or are unsure about it. With this application, you can see the video format and encoding details. On Android devices, you can use applications such as Codec Info or AIDA64 to view video or audio codecs.
If the video codec is not standard, your device’s processor probably does not support it. If you want to know what codecs Android devices support, you can see a list of codecs that Android devices must support on the Android Developers website.
Usually, new Android phone processors have the necessary processing power to decode codecs that the device does not support. On the other hand, some powerful player software such as VLC can easily play video files with uncommon codecs through software decoding and without using the hardware accelerator function. Of course, using such software increases the phone’s temperature and increases its battery consumption.
Most Common Audio Encoding Formats
Using an audio file requires you to decide what format you will use and whether you will be willing to make any compromises. Here is an overview of each audio file format:
MP3
As well as providing small file sizes, MP3 audio formats also showcase lossy compression, which may lead to a loss of audio quality. MP3 audio files are increasingly used for streaming music over the Internet and storing files on mobile devices.
M4A
Audio files in the M4A format are generally compatible with video files in the MPEG-4 format that are found on Apple devices. They are smaller in size than MP3 files and have similar sound quality.
AAC
Similar to MP3, AAC offers better sound quality and smaller file sizes, which makes it more suitable for streaming music over mobile devices such as Android smartphones, Apple Music, and YouTube.
OGG
There are both free and paid versions of Ogg Vorbis, and it is a codec similar to MP3 and AAC, which is an open-source codec. Spotify uses it in their streaming services where they stream at 160kbps for the free version and 320kbps for the paid version.
WAV
In general, WAV files are uncompressed audio files with great sound quality. They are often used for encoding audio for CDs and offer great sound quality. However, WAV doesn’t store much metadata and has a very large size.
FLAC
FLAC is an encoding format that stores metadata. It is widely used for downloading and storing audio files in high resolution.
ALAC
Apple only uses ALAC lossless audio codec, similar to FLAC, on its devices. iTunes, as well as Apple’s music player, are compatible with this codec.
Audio Codes Comparison
There is no single optimal audio codec since your choice will depend totally on your needs. The following table will provide you an insight of how they compare, as you have already learnt about several of them in this tutorial.
Codec | Type | Cost | Creator | First Published |
MP3 | Lossy | Free | ISO/IEC MPEG Audio Committee | 1993 |
AAC | Lossy/Lossless | Non-Free | ISO/IEC MPEG Audio Committee | 1997 |
WAV | Lossless | Free | Conifer Software | 1998 |
OGG | Lossy | Free | Xiph.Org Foundation | 2000 |
FLAC | Lossless | Free | Xiph.Org Foundation, Josh Coalson | 2001 |
ALAC | Lossless | Patent Claims | Apple Inc. | 2004 |
Finally
If you are a VoD or AoD website owner and service provider, codecs should matter to you as they handle most of the stages of video and audio sharing. A large part of the streaming quality relies on codecs and iIt is important to know what they are and how they function.
Check ArvanCloud Video Platform for high-quality video, audio, and live streaming product and FREE packages.