logo api.video

Encoding and transcoding: what's the difference?

February 9, 2021 - Erikka Innes

Encoding and transcoding are often used interchangeably but they have slightly different definitions. Encoding is when you take an uncompressed, raw video source and compress it. Typically this is done to create a smaller file, because it's easier to use with more devices. Transcoding is when you take an already compressed video source, and transfer it to a different format. Let's go into a bit more detail for each of these.

What Are Some Examples of Encoding?

For encoding, it's easy to say it's when you go from an uncompressed source to a compressed source, but you may ask, what's a good example of an uncompressed, raw video source? Technically it's anything where the video file contains data that comes directly from a camera sensor vs. encoded video. In the digital space, it's SDI (Serial Digital Interface) or HDMI (High Definition Multimedia Interface). These are both popular standards. You'll find HDMI in places like your GoPro camera, or a mini camcorder. These days, you might also find HDMI in professional settings, but SDI is more common due to its reliability. Another example of an uncompressed source would be something analog - VHS tapes are an example of an analog source.

<center><iframe src="https://giphy.com/embed/fDNGJgYm6xIfm" width="480" height="371" frameBorder="0" class="giphy-embed" allowFullScreen></iframe><p><a href="https://giphy.com/gifs/animated-gif-vcr-vhs-juggler-fDNGJgYm6xIfm">Transfer from a medium like VHS to digital would be an example of encoding (though not very common today).</a></p><br></center>

What Are Some Examples of Transcoding?

Transcoding is when you take an encoded or transcoded file, and convert it to another format. There are three types of transcoding, depending on what you are trying to do to get a video to suit a particular browser, player, or platform:

  • Lossless-to-lossless - This type of transcoding maintains the quality of your video across formats but allows you to take advantage of better hadware or compression algorithms.
  • Lossless-to-lossy - Your video will decrease in quality, but you will gain some benefit as a result, for example a smaller and/or faster playing file, or a file that is compatible with the requirements of a particular platform, player, or browser.
  • Lossy-to-lossless - Sometimes people think this means they are regaining quality. This isn't the case. If you transcode from a lossy format to a lossless format, all that it means is that you will not lose additional quality in the conversion process. You cannot regain data you already lost through compression.

Codecs for Encoding and Transcoding

For both encoding and transcoding, you make use of codecs to complete the task. A codec's job is to compress and decompress video files. It's right there in the name - codec is short for compress decompress or encode decode. It's an algorithm that takes the video and shrinks it or changes it into a format that makes it compatible with the requirements of wherever you want the video to play. There are many codecs because there are many ways to compress a video or livestream for playback.

What is Transmuxing?

Hopefully, this clears up the difference between encoding and transcoding. Before we go, let's throw one more term in there - transmuxing. Try not to confuse transmuxing with encoding and transcoding. Transmuxing is when you change the container for a video instead of the format. It's a way of repackaging a video to make it compatible somewhere without changing what's in the file. This process is faster than encoding or transcoding and takes less computing power because you only change the container, not the file. It's great when you need to quickly make something available, but the downside is that it doesn't handle things like making multiple video resolutions available. If you choose a container type that's incompatible with your video file, you may also cause compatibility issues, resulting in not being able to play the video.

In closing:

  • Encoding - is when you compress a raw data file from a video camera sensor or an analog source like a VHS tape.
  • Transcoding - is when you take an already compressed video file and change it to another format.
  • Transmuxing - is when you change the container of a video file but leave the video file untouched.

Thanks for reading! If you have any questions, please join our community forum.


Erikka Innes

Developer Evangelist