Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between audio encoding/decoding and format conversion

Recently i have been trying to convert an audio file from one format to another through ffmpeg. i was trying to do some google but results made me a little confused about the difference between encoding and decoding an audio file and converting from one format to another.

like image 589
Talha Malik Avatar asked Jan 13 '23 17:01

Talha Malik


1 Answers

Let me describe it this way: There are several different file formats for video files (sometimes also called "wrappers"). There are also several different codecs which can be used to encode (or compress) the audio and video. Audio and video use different codecs - and the encoded formats can be sorted in different file types/formats.

So when you talk about "encoding" vs. "converting" a couple of things come into play.

"Encoding" would be the act of taking audio/video and encoding them into a given codec(s). "Converting" implies having stuff in one format, but wanting it in another. There are two ways of looking at this:

  1. Often called "repackaging" - this is when the video (for example) has been encoded correctly (let's say h264, with a bunch of parameters), but you want it in a different file-type - maybe it's an .AVI and you wanted it in an .MP4. This doesn't involve changing the actual video - just re-wraping the h264 stream in a new "wrapper", and is thus a fast operation.

  2. Re-encoding. Let's say your audio was in a MP3 format, and you wanted it in an AAC format. This would require decoding the entire MP3 stream, and re-encoding it into AAC.

Obviously you can also do "1" and "2" together.

Refer Formats and Codecs for detailed information.

Hope it helps!

like image 81
Brad Avatar answered Jan 30 '23 23:01

Brad