1. What Is a Codec?
Or, Everything You Wanted to Know About Digital Streaming
Video But Were Afraid to Ask
2. What we’re NOT going to talk
about:
The history of the moving image and recorded sound
FlipbooksZoetropeMoviesPhonoTalkiesTV
http://en.wikipedia.org/wiki/Film
http://en.wikipedia.org/wiki/Audio_recording
http://en.wikipedia.org/wiki/Television
3. What we’re NOT going to talk
about:
The Nyquist-Shannon Sampling Theorem
“…shows that a bandlimited analog signal that has been
sampled can be perfectly reconstructed from an infinite
sequence of samples if the sampling rate exceeds 2B
samples per second, where B is the highest frequency in
the original signal. If a signal contains a component at
exactly B hertz, then samples spaced at exactly 1/(2B)
seconds do not completely determine the signal,
Shannon's statement notwithstanding.”
http://en.wikipedia.org/wiki/Sampling_theorem
4. What we’re NOT going to talk
about:
Pulse Code Modulation and uncompressed, digitized
sound
http://en.wikipedia.org/wiki/PCM
5. What we’re NOT going to talk
about:
How uncompressed, digitized video has to represent
three color values (called red chroma, green chroma,
and blue chroma) and three brightness values (called
red luma, green luma, and blue luma) in zeroes and
ones for each and every pixel, for each and every
frame*
*Other representational schemes (like CCIR-601) condense these values to use fewer
bits-per-pixel, as the human eye sees no real difference when it’s done that way
http://xiph.org/video/vid1.shtml
6. What we’re NOT going to talk
about:
How “uncompressed digital video” and “uncompressed
digital audio” don’t really exist in today’s world
http://digitalcontentproducer.com/mag/video_uncomp
ressed_digital_video/
7. What we ARE going to talk
about:
Why your #&*$%*@# video file won’t play in
QuickTime/Windows Media Player/IE/Firefox
Codecs and Containers
Web Streaming
8. The Facts:
The word “codec” works like the word “modem”
Code-Decode Modulate-Demodulate
is to as is to
Codec Modem
A codec is a playback algorithm that is specific
to the process used when creating the media
file.
9. The Facts:
In order to play a video file, your computer must have a
program capable of playing back videos having that
specific file extension, like .MP4, .MOV, .AVI, .FLV,
.VOB, or .ASF – these are known as “container
formats”
And that program must have access to the codec
specific to videos encoded with that codec in mind
10. The Facts:
A codec can be part of the computer’s core operating
system, as a codec within its multimedia playback
framework, like in QuickTime or Windows Media Player
A codec can be part of a self-contained application, like
in VLC Media Player or WinDVD
A codec can be part of an application’s plug-in
architecture, like the Shockwave Flash plug-in used to
play back Flash videos in Firefox
11. The Facts:
In the early days of video playback software, only a few
codecs were in use and a codec tended to be exclusive
to a specific media player. This made it easy to
generalize "if the filename has X extension, I'll need
program Y to play it."
12. The Facts:
Today, you can’t look at the dot-extension on a filename
and know for certain that the program that “goes with”
that container will be able to play back the video
For instance– ‘Export to QuickTime’ in Avid Media
Composer produces a .MOV file that won’t play back in
QuickTime on a computer that doesn’t have the Avid
codecs installed
13. Answers:
How can I determine which codecs are installed on my
computer?
Since there are three ways codecs can live on your
computer, it's not so simple to do a “codec check.” If the
video doesn't play at all or plays without sound or with
sound and no picture (and the original tape plays back
fine), you've probably got a codec issue with your media
player.
14. Answers:
How can I determine which codec was used to encode
a file?
Use VLC Media Player!
17. Adding Codecs to QuickTime:
Third-party, free codec pack for the Mac– Perian
Codec pack for Windows Media codecs in QuickTime
as well as the browser– Flip4Mac
18. Adding Codecs to
Windows Media Player:
Safe, comprehensive, free codec pack for Windows
K-Lite Codec Pack (careful where you get it from)
http://www.majorgeeks.com/K-
Lite_Mega_Codec_Pack_d5230.html
http://codecguide.com/download_k-
lite_codec_pack_mega.htm
19. Codecs in Video Editing
Software:
In today’s world you’ll commonly convert a video file having one codec
into a different video file having a different codec. Doing this is called
‘transcoding.’
Depending on which codecs are involved (which determines the
complexity of the job) and the speed of your computer hardware, it may
be possible to transcode media streams in real time, or even faster-than-
realtime.
When you 'capture’ footage to a modern video editing suite, it’ll usually
automatically transcode into the software's preferred native, internal
codec, or, in Apple terms, an 'intermediate codec.' This is done to optimize
video response of the software's playback window.
20. Web Streaming:
Guess what? It’s ALL streaming!
Within the container, audio and video streams can be
‘muxed’ or ‘de-muxed,’ that is, seen as separate
streams by the media player or as a single, integrated
stream (VLC can show you which streams in your
container are muxed and which ones aren’t)
Each stream is pulled through the player at a different
rate– think of this as the bitrate for playback
21. Web Streaming Protocols:
When you’re streaming media over a network
connection, the protocol serves as your container
RTSP– Real Time Streaming Protocol– used by
RealMedia/RealVideo/RealAudio and QuickTime
Streaming
RTMP– Real Time Messaging Protocol– used for Flash
video/audio only
MMS– Microsoft Media Services
HTTP streaming media/HTML5
Editor's Notes
CUE: after first point (don’t read asterisked text)
And that’s not counting sound!
CUE: after first point
More about containers later on…
CUE: before slide text
So where do codecs live on your computer?
CUE: after first point
QuickTime codecs are available to other all programs that leverage QuickTime for media playback, by the way. A lot of free software does this…
CUE: after second point
We’ll be talking more about VLC and free vs. paid codecs later…
CUE: after first point
In fact, only the very first MPEG video codec (today known as MPEG1) was common to early versions of both QuickTime and Windows Media Player, and RealPlayer was the only player that handled its media type(s).
CUE: after first point
If the program that “goes with” that container doesn’t contain the necessary codec, you’re out of luck.
It’s the price of freedom– people sided with their favorite media player and demanded it start to overlap its supported container types.
CUE: after slide text
…or you might have a corrupt media file.
CUE: after slide text
It doesn’t cost anything, it’s open source software, it’s available for Mac, Windows, and Linux.
And as a bonus, it’ll play back almost anything ‘cause it has about every codec you’d ever need built-in.
CUE: before slide text
You might already have VLC in your Applications folder!
It’s definitely installed on the multimedia workstations at the Missourian and in the Futures Lab…
CUE: before slide text
All my VLC examples are from the Mac version…
Find any random piece of media and open it in VLC. Control-click the file, and tell it to Open With VLC. It’ll start to play automatically– just hit the space bar to pause.
Then hit Command-I and click the Codec Details tab. The picture on this slide shows what you’ll see after you expand the triangles next to the two streams, and in this picture I’ve opened a tutorial video I edited and exported using iMovie.
Stream Zero is the video track, and we can see this sample file’s video uses the H.264 codec, with a 29.97 fps frame rate and video window dimensions of 960x540 pixels.
Stream One is the audio track, and we can see this sample file’s audio uses MPEG AAC codec, it’s in stereo, and uses 44.1khz sample rate
CUE: before slide text
While VLC is a decent video player and it comes with loads of codecs pre-installed, there are times when you’d rather use another program to show your media.
Personally, I’d rather show a .MOV-container-type video file using QuickTime Player than use VLC for the job. So how do you get new codecs into QuickTime?
Luckily, you have some options for easily adding a bunch of third-party codecs at once. On the Mac, there’s Perian and Flip4Mac.
There’s some amount of overlap in the codecs provided by Perian and Flip4Mac, but I haven’t seen anything negative from having both installed on the same machine. One thing Flip4Mac gives that Perian does not– Mac browser support for Windows Streaming Media
CUE: after slide text
*be VERY WARY of anything popping up on your screen informing you that you need 'Codec X' in order to play back a media file you found online or were sent in an email* If you've already got a common codec pack installed on your computer, you should already be able to play the file back, if it's a legit file. Chances are they're just trying to get you to pay for something you don't need or are trying to trick you into installing malware onto your computer.
CUE: after first point
Doesn’t matter if we’re talking local playback or playback over a network connection.
When you're playing any audio or video file on your local computer-- leaving out the Internet entirely, for now-- the program playing the file looks at the binary data composing the media file sequentially
like pulling a string of beads through your fingers-- the speed at which it's being pulled through is like the "bitrate" in kbps. The media player tries to play back the file at the bitrate it was recorded at.
the string of beads is a "stream" of zeroes and ones, and every stream of data needs to have some structure to let us know what's sound and what's picture data (and what data belongs to which frame if we're talking video)– it’s technically the encoding scheme that applies this structure. The container lets us bundle one or more streams as a single media file.
CUE: after second point
Muxing is most evident with audio tracks. If a track shows up as ‘stereo’ in a single stream, you know it’s muxed (left and right). It would be possible to extract just the left or just the right channel by first separating the audio track and then ‘de-muxing’ it into left and right.