DSPRelated.com
Forums

codecs and file format

Started by kaus...@yahoo.com September 1, 2008
Hello everybody,
-I often get confused between an audio codec and an audio file format. Doesnt a .mp3 extension necessarily mean that the file has been encoded using 'mp3' encoding format?

-Another question, can you please point out the basic differences between how decoding of an audio file is carried out in an audio player (like an ipod) and an audio player application (like windows media player)?

-One last question, for interconverting between file formats, the media player application should contain the algorithm for both encoding and decoding of the file formats in question correct? So now if what I said in question 1 is correct, then if a .mp3 file is required to be converted to, say .wma, how will my application know if my .mp3 file was actually encoded using the mp3 codec format?

Im genuinely interested in understanding audio processing. Some of these question might be elementary, but please do reply. Even a short description would suffice.

-Kaushik
Hello everybody,
>-I often get confused between an audio codec and an audio file format. Doesnt a .mp3 extension necessarily mean that the file has been encoded using 'mp3' encoding format?
>
>-Another question, can you please point out the basic differences between how decoding of an audio file is carried out in an audio player (like an ipod) and an audio player application (like windows media player)?
>
>-One last question, for interconverting between file formats, the media player application should contain the algorithm for both encoding and decoding of the file formats in question correct? So now if what I said in question 1 is correct, then if a .mp3 file is required to be converted to, say .wma, how will my application know if my .mp3 file was actually encoded using the mp3 codec format?
>
>Im genuinely interested in understanding audio processing. Some of these question might be elementary, but please do reply. Even a short description would suffice.
>
>-Kaushik
>
>

Hello again,
Alright i think i messed up my second question. This is what i meant:
There are DSP decoder chips used in set-top boxes etc. to decode incoming audio signals. How is this different from the decoding done by a media player application that has the corresponding codec?

-Kaushik
k...@yahoo.com wrote:

> Doesnt a .mp3 extension necessarily mean that the file has
> been encoded using 'mp3' encoding format?

Not necessarily. If I take an Ogg/Vorbis file and rename it to
whatever.mp3 its still an Ogg/Vorbis file. On Linux, even a basic
rather dumb utility like the file command still knows its an Ogg
file:

> file a.mp3
a.mp3: Ogg data, Vorbis audio, stereo, 44100 Hz, ~128000 bps,
created by: Xiph.Org libVorbis I

When opening a file, any well written audio player should ignore
the file name extenstion and inspect the actual file to figure
out the format.

> -Another question, can you please point out the basic differences
> between how decoding of an audio file is carried out in an audio
> player (like an ipod) and an audio player application (like windows
> media player)?

There are no fundamental differences. A minor difference might be
that the code on the portable device might be using nothing but
fixed point arithmetic while the computer audio player uses floating
point operations.

Both players will use the same algorithms to decode the file and to
convert it to PCM audio for presentation to the audio hardware.

> -One last question, for interconverting between file formats, the
> media player application should contain the algorithm for both
> encoding and decoding of the file formats in question correct?

Yes.

> So now if what I said in question 1 is correct, then if a .mp3 file
> is required to be converted to, say .wma, how will my application
> know if my .mp3 file was actually encoded using the mp3 codec format?

The MP3 file (as well as Ogg/Vorbis and WMA and most other audio files,
even WAV files) contains two kinds of data; the encoded audio data
and file structure data. For MP3 files (and most other file formats
more advanced that WAV/AIFF/AU etc), the file structure data contains
things like a marker that indicates the start of a block (used for
seeking), the size of the block and any special information required
to decode that block.

The differences between say MP3 and Ogg/Vorbis is that they used different
markers for the structure blocks, probably different types of data and
because they use different algorithms, they encode the audio data in
a different way as well.

HTH,
Erik
--
-----------------------------
Erik de Castro Lopo
-----------------------------
"If all you know is C, everything begins to look like a
segmentation fault." -- dlsspy on reddit.com
Hi Kaushik,

All the audio files will have appropriate HEADERS with which the
application can find the Codec in which it has been encoded. For example
BMP Image files will have 54 Byte Header for storing the Image Type, Image
Width, Image Height, Color Depth etc., These details can be found at:

http://dspfans.blogspot.com/2008/03/bmp-bitmap-files.html

Similarly each audio file, for example MP3, AAC, will have appropriate
headers with which the application can find the codec to be used for
decoding the audio.

Interconversion:
This process is called Transcoding. For transcoding we need the decoder of
the current audio file and the encoder to which the file is to be
converted.

Yaa. MP3 Extension files have been encoded using the MP3 Encoder.

--
Karthick Kumaran A S V.
DSP Engineer.
> Hello everybody,
> -I often get confused between an audio codec and an audio file format.
> Doesnt a .mp3 extension necessarily mean that the file has been encoded
> using 'mp3' encoding format?
>
> -Another question, can you please point out the basic differences between
> how decoding of an audio file is carried out in an audio player (like an
> ipod) and an audio player application (like windows media player)?
>
> -One last question, for interconverting between file formats, the media
> player application should contain the algorithm for both encoding and
> decoding of the file formats in question correct? So now if what I said in
> question 1 is correct, then if a .mp3 file is required to be converted to,
> say .wma, how will my application know if my .mp3 file was actually
> encoded using the mp3 codec format?
>
> Im genuinely interested in understanding audio processing. Some of these
> question might be elementary, but please do reply. Even a short
> description would suffice.
>
> -Kaushik
>
--- In a..., kaushik_l@... wrote:
>
> Hello everybody,
> >-I often get confused between an audio codec and an audio file
format. Doesnt a .mp3 extension necessarily mean that the file has
been encoded using 'mp3' encoding format?
> >
> >-Another question, can you please point out the basic differences
between how decoding of an audio file is carried out in an audio
player (like an ipod) and an audio player application (like windows
media player)?
> >
> >-One last question, for interconverting between file formats, the
media player application should contain the algorithm for both
encoding and decoding of the file formats in question correct? So now
if what I said in question 1 is correct, then if a .mp3 file is
required to be converted to, say .wma, how will my application know if
my .mp3 file was actually encoded using the mp3 codec format?
> >
> >Im genuinely interested in understanding audio processing. Some of
these question might be elementary, but please do reply. Even a short
description would suffice.
> >
> >-Kaushik
> >
> >
> >
> > Hello again,
> Alright i think i messed up my second question. This is what i meant:
> There are DSP decoder chips used in set-top boxes etc. to decode
incoming audio signals. How is this different from the decoding done
by a media player application that has the corresponding codec?
>
> -Kaushik
>

Hi Kaushik,

This is what understand regarding your queries :
>1. Doesnt a .mp3 extension necessarily mean that the file has been
>encoded using 'mp3' encoding format?
Yes, it does, but there is a difference between a encoder and a file
format, as in, mp3 file may contain some other metadata (like id3
tags) related to the mp3 encoded data present in the same file.
Although, this metadata does not contain any encoded audio data as
such but is some relevant information about the contained encoded
audio data.

>2. There are DSP decoder chips used in set-top boxes etc. to decode
> incoming audio signals. How is this different from the decoding >
done by a media player application that has the corresponding codec?
In the first case, its a hardware decoder, which essentially contains
some part of decoder software burnt as hardware itself, to decode at
higher speed. While in the second case its the software decoder, i.e.
the standard algorithm to decode the stream implemented in software.
This is not expected to be as fast as the hardware decoder as its
speed depends on the processing speed of the underlying processor on
which this software is running.

>So now if what I said in question 1 is correct, then if a .mp3 file
>is required to be converted to, say .wma, how will my application
>know if my .mp3 file was actually encoded using the mp3 codec format?

This can be found out using some headers which are present in the file
format and define that the data encoded in this file follows a certain
encoding. Check this link for details. :
http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
My opinion as follow may be wrong:
for STB, a block of encoded data(such as 1K) is provided into decoder, so a frame or some frames raw data of pcm are obtained, in fact there maybe exist remains of encoded data which is not decoded because of short of data, and the remains is buffered to decode next---get other encoded data from internet.
for media player, a frame is decoded generally.

2008-09-01 23:11:13k...@yahoo.com ะด

Hello everybody,
>-I often get confused between an audio codec and an audio file format. Doesnt a .mp3 extension necessarily mean that the file has been encoded using 'mp3' encoding format?
>
>-Another question, can you please point out the basic differences between how decoding of an audio file is carried out in an audio player (like an ipod) and an audio player application (like windows media player)?
>
>-One last question, for interconverting between file formats, the media player application should contain the algorithm for both encoding and decoding of the file formats in question correct? So now if what I said in question 1 is correct, then if a .mp3 file is required to be converted to, say .wma, how will my application know if my .mp3 file was actually encoded using the mp3 codec format?
>
>Im genuinely interested in understanding audio processing. Some of these question might be elementary, but please do reply. Even a short description would suffice.
>
>-Kaushik
>
>

Hello again,
Alright i think i messed up my second question. This is what i meant:
There are DSP decoder chips used in set-top boxes etc. to decode incoming audio signals. How is this different from the decoding done by a media player application that has the corresponding codec?

-Kaushik