Transcoding is a vital process that enables digital media to be converted between formats, ensuring that your digital content remains accessible regardless of your audience’s device or bandwidth. You’ll learn about the critical role transcoding plays in streaming services, its ability to unify different file types, support a variety of devices, optimize storage space, and facilitate adaptive streaming. By the end of this article, you’ll understand how transcoding works and its indispensable function in our technologically diverse world.
What Is Transcoding?
Transcoding is the conversion of compressed digital media between formats. Media is encoded in one specific format, and transcoding takes that same media but encodes it differently. Typically, the data is a video or audio file, but it can be even an image or even text.
Encoding is another term that we should clarify before we dive deeper. The words “encoding” and “transcoding” sound similar and are indeed related terms, but different nevertheless. Encoding refers to compressing the original media data into one target format, whereas transcoding re-encodes the already-encoded media to another format. You can’t have transcoding without first encoding. So, using words “encoding” and “transcoding” interchangeably, although common, would be a mistake.
One place where transcoding inevitably occurs is in digital video distribution. Nowadays, when you use devices like digital cameras, the outcome media is encoded one way or another, because you pre-configure the parameters of the recorded media—like frame size and audio bitrate—in your camera settings. Typically, the codec used to encode media is configured in the camera. However, to adapt the media for playback on different devices or even make it possible to play at all, it often needs to be transcoded to another format.
Transcoding Reasons, Use Cases, and Benefits
Transcoding can be beneficial across industry types, for businesses of all sizes. Let’s explore some ways in which transcoding can help businesses thrive, and understand some real-life examples of its application.
Transcoding Helps Support Different Device Types
It often happens that the format in which a media was originally encoded is not suitable for playing on all devices. The variety of personal computers, smartphones, tablets, and digital TVs available has led to diversity in software and media formats requiring support. By creating many copies of the original file, each encoded differently, transcoding allows the delivery of the media to all devices in the format each device requires.
Transcoding Helps Save Space
Another common reason for transcoding is reducing a media file’s size; quality media usually requires a lot of space, but certain formats less so. This is particularly of interest when using encoding formats preserving the original quality. You can, for example, store photos and videos taken with your digital camera on your computer’s hard drive at the original (or close to original) quality, but in a file with reduced size.
Transcoding Helps Unify Different Files
Imagine you need to deal with many video or audio files encoded in different formats, for example, while working on a documentary movie or archiving footage received from different sources. Transcoding can convert all of the files to a single format that is convenient for you to work with.
Transcoding Helps Adaptive Streaming
And finally, transcoding is unavoidable in streaming and sending media files via the internet in general. It helps to adapt a file to different bandwidths and screen sizes. In fact, sometimes transcoding the original file using a lower resolution or different codec is the only way to enable the content receiver to play it.
How Does Transcoding Work?
Now that we know what transcoding is and why we need it, we can explore how it works and what is needed to transcode a media file.
Transcoding is a two-step process (see Figure 1):
- Decoding the original media into an intermediate, uncompressed format. In this case, the word “uncompressed” doesn’t mean “without a loss”: If the file initially was encoded with a loss, the same level of loss will be present in the intermediate representation as well.
- Re-encoding, typically, to another format or using a different set of parameters.
So, a transcoder is a software or hardware device that performs transcoding. It takes the original media file, decodes it, and re-encodes it into a target format.
Types of Transcoders
Transcoders can be classified on different grounds. To start with, there are transcoders that work with different types of media—most often audio, video, or images. But that’s not all. Let’s see how else transcoders could be categorized.
Hardware and Software Transcoders
The classification that divides transcoders into software applications and hardware devices is the most fundamental. There are many transcoding software options available on the market, from the popular command line tool FFmpeg that can be integrated into any kind of infrastructure, through to shiny multi-functional apps like Adobe Premiere Pro. A software transcoder is the most obvious, and often free, option.
At the same time, transcoding itself can demand massive computational powers. Even if you transcode in background, a performance hit in the foreground processes is inevitable. As such, sometimes a hardware transcoder makes a better sense: While the specialized piece of hardware works, the main computer is free for performing other tasks.
Hardware transcoders have chips and boards dedicated and heavily optimized for the job, and as a result the process is completed more efficiently. On the other hand, it also means that you have less freedom: Some encoding parameters are burned into the chip and can’t be easily altered.
Cloud and On-Premises Transcoders
If you own a video service, you can transcode your video files yourself. Sometimes, it’s good to have everything under your control. But it’s also a responsibility and, of course, brings additional costs.
Many cloud platforms offer transcoding as a part of their services, including Gcore. Outsourcing the task to another service makes transcoding someone else’s headache.
Live and Offline Transcoders
Transcoding a stored file and saving the result in another file is the most straightforward workflow that comes into mind. However, it’s not always the way it works. When it comes to live streaming, especially with adaptive bitrate, live transcoding comes in. It’s tricky and even more labor intensive than the offline version, because any mistake—and slow processing—will increase latency, resulting in playback hiccups.
Transcoding vs. Transmuxing Processes
The transcoding process is somewhat similar to, and often confused with, transmuxing. But transmuxing is different because it keeps the media format and quality unaltered and merely repackages it into a different media container or delivery format. As we now understand, transcoding goes beyond this by altering the contents of the package: It changes the way the packed media was encoded, including its compression rate, bitrate, and frame size.
Types of Transcoding
Generally, transcoding keeps data compression on the same level or increases the level of compression, discarding more data and resulting in a loss of quality. Transcoding can be divided into three types based on compression and quality loss:
- Lossless-to-lossless
- Lossless-to-lossy
- Lossy-to-lossy
The word “loss” in this case means a discarded part of the data of the original file. As a result, the file has a smaller size, but its contents are of lower quality.
In the first scenario, lossless-to-lossless, the original quality is preserved. You might want to re-encode your losslessly compressed file using a different set of codecs (i.e., the algorithms which are used to compress the media) that demands less space for the outcome; compression algorithms evolve continuously and the most modern ones can offer better compression without quality loss.
The second option, lossless-to-lossy transcoding, means that the transcoded media has the original quality which is lost during transcoding due to a deeper compression.
Finally, the lossy-to-lossy transcoding refers to the situation when the media is already compressed with quality loss, and transcoding either leaves the same degree of compression, or uses an even more intense algorithm that results in a further quality loss. Thus, repetitive lossy encoding cumulatively worsens the media quality.
Until recently, the option of lossy-to-lossless transcoding was out of question: If the original media was compressed with any loss, there was no way on earth to restore previously discarded data (and, thus, regain the original quality.) Now, AI/ML is beginning to provide solutions that can restore the original quality.
Here’s a table that summarizes the differences of the three most common types of transcoding:
Transcoding type | Initial quality | Resulting quality |
Lossless-to-lossless | Original, no quality loss | Original, no quality loss |
Lossless-to-lossy | Original, no quality loss | Compressed, with some loss of quality |
Lossy-to-lossy | Compressed, with a loss of quality | Compressed, with more loss of quality |
Apart from the loss-based classification, there are various types of transcoding that can be used separately or combined together in a single operation. Let’s take a look at them in the next few sections.
Re-Encoding
Sometimes, encoded data needs editing. For instance, you need to reorder scenes in a video. In this case, the file is decoded, edited, and then re-encoded to the same format. So, this type of transcoding doesn’t affect audio or video codecs used for encoding or framerate of a video. It’s used to decode the media and re-encode it back using the same parameters after the editing is complete.
In the digital world, it’s hard to keep the original quality in the edited version, so re-encoding a lossy format leads to further losses. To avoid this pitfall, it’s better to edit the original file and encode it only when it’s ready.
Transrating
When a media needs to fit a smaller space or lower bandwidth, its bitrate can be changed, say, from 12 to 4 Mbps. This process is called transrating. The format and codec stay the same, only bitrate is changed.
Transsizing
As its name suggests, transsizing—also known as scaling—refers to changing an image or video frame size. This is, for example, what Netflix does when you downgrade your Premium plan including 4K HD Ultra HD video to the Basic plan, which includes only the 720p HD resolution.
In theory, transsizing can be performed during playback, but in most cases, it makes more sense to perform it beforehand to spare computational resources and space. In the case of streaming, transsizing before playback reduces the quantity of transferred data.
What Role Does Transcoding Play in Streaming?
Video streaming is where transcoding shines, and here’s why. The world of media content production is constantly evolving, with new media formats and capturing devices introduced frequently. Content-consuming devices, especially smartphones and tablets, are also subject to regular new releases and updates. This ever-changing variety introduces challenges for video and audio streaming: Once created and encoded, the media is expected to be able for playback anywhere.
This is where transcoding comes into use: It is an integral intermediate step in content delivery, which ensures that as many target devices as possible are supported.
Apart from the (in)compatibility issue, different devices have different screen sizes and resolution, as well as varying levels of connectivity. Transcoding ensures that various resolutions and sizes of the same video are ready for the adaptive streaming protocols, like HLS. Just think of how YouTube picks the most suitable quality of a video so that you can watch it continuously, without lagging.
As a result, the media is available to a wide audience with the best possible quality and minimal buffering time. It’s exactly what your viewers need.
How Gcore Can Help You Not To Think About Transcoding in Streaming Services?
Everything said above makes transcoding a crucial component for content delivery that, at the same time, might also become very tricky to implement. As an advanced service that provides video hosting and streaming solutions, Gcore takes full care of transcoding of your media.
Not only does Gcore make sure that videos are delivered to all known device types, we do so in an adaptive manner so that people with any connectivity level are covered. Additionally, Gcore’s failsafe transcoding system improves transcoding stability, helping your content reach the widest possible audience.
Conclusion
To summarize, transcoding re-encodes media files, adapting them to different devices, bandwidths, and purposes. If you need to host or stream video or audio content, or if you just need to save some disk space for storing more media, it’s time to look into transcoding.
As crucial as it is for content delivery, transcoding can also be a complicated and expensive operation. You may want to hold full control (as well as responsibility and expenses) in your hands—or you could let a specialized service, like Gcore, take care of the details.