HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: stigc on 2012-10-07 12:46:16

Title: Detecting codec in a stream
Post by: stigc on 2012-10-07 12:46:16
How does e.g. VLC detects the codec when opening a http stream?

Both AAC and MP3 has a very short sync mark which often appears in other streams.

http://www.flickr.com/photos/52807817@N00/4423485655/ (http://www.flickr.com/photos/52807817@N00/4423485655/)
http://www.mp3-tech.org/programmer/frame_header.html (http://www.mp3-tech.org/programmer/frame_header.html)
Title: Detecting codec in a stream
Post by: stigc on 2012-10-07 13:07:08
I guess VLC parses the frame length number and sees if it matches the next sync mark?
Title: Detecting codec in a stream
Post by: benski on 2012-10-07 18:38:04
The first four bytes of an ADTS AAC frame header look exactly like an MPEG-1/2 "Layer 4" frame.  So it's quite easy to detect the difference.