185 lines
13 KiB
Plaintext
185 lines
13 KiB
Plaintext
|
|
Episode: 26
|
||
|
|
Title: HPR0026: Intro to codecs
|
||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr0026/hpr0026.mp3
|
||
|
|
Transcribed: 2025-10-07 10:26:34
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
MUSIC
|
||
|
|
Welcome to Hacker Public Radio. My name is Klaatu. I'm here to talk about
|
||
|
|
Codex, Video Codex, and Audio Codex alike. This is going to probably end up
|
||
|
|
being sort of an in-depth series since this is such a huge subject. I want to
|
||
|
|
instill a little bit of an understanding in you about how Codex work and kind
|
||
|
|
of what they do and why they exist at all. But I also want to maybe talk
|
||
|
|
about each or some of the major Codex out there and maybe some of some of the
|
||
|
|
features of each and why they exist, where they come from, things like that,
|
||
|
|
whether they're free, non-free, stuff like that. And of course the other side of
|
||
|
|
I mean the different sides of Codex are the compression and the decompression of
|
||
|
|
the content. So I'd like to talk a little bit about that. So initially I think
|
||
|
|
what is a Codex? That's something that a lot of people don't quite understand.
|
||
|
|
A lot of people know empirically that they need a Codex because when they click
|
||
|
|
on a file or they go to a site, the video doesn't play and it tells them to
|
||
|
|
install a Codex or a plug-in for their browser. So a lot of people realize that
|
||
|
|
there's a need for them to install a Codex. But not many people really know
|
||
|
|
what a Codex is. The word Codex is actually it's like modem or something like
|
||
|
|
that. It's not really, you know, we say it as a word, it's actually two words
|
||
|
|
put together. It's code and decode, CO for code, DEC for decode. And the idea
|
||
|
|
behind a Codex simply is at least in its most pure form and I'll explain what
|
||
|
|
I mean by that in a little while. In its most pure form, a Codex simply
|
||
|
|
exists because video does not originate on your computer. Obviously what we
|
||
|
|
see in the real world is not digital. Something needs to make them digital. And
|
||
|
|
this is where Codex come in. So a Codex is simply a mathematical method of
|
||
|
|
taking a signal and turning it into a digital stream of information. So Codex
|
||
|
|
are actually at work, hard at work on your camera well before you ever get to
|
||
|
|
your computer. I mean obviously your digital video cameras are, you know,
|
||
|
|
obviously they have embedded computers in them. So when you're taking video,
|
||
|
|
whether it's mini DV or HDV or AVCHD or whatever, the video is being
|
||
|
|
processed by a codec and it's being stored in a certain format and then
|
||
|
|
you're transferring that to your computer to either edit it or to store it or
|
||
|
|
to convert it to DVD or whatever you're going to do without video. So obviously
|
||
|
|
Codex have to exist. If we want to have video on our computers, the question
|
||
|
|
is do they have to exist in the way that they exist? And the answer to that is
|
||
|
|
probably not. Codex are also a big business. There are companies out there that
|
||
|
|
are in the business of having created a Codex and having come up with a
|
||
|
|
scheme to make people come to them to be able to use that Codex. It's not always
|
||
|
|
the end user that needs to go to that company. Sometimes we do in order to
|
||
|
|
download the Codex especially in Linux where there are very few Codex included
|
||
|
|
with our operating system. But even, you know, I mean if you've paid for your
|
||
|
|
operating system, if you've paid for either Windows or Mac OS 10, someone from
|
||
|
|
one of those two operating systems has gone to these companies, signed a license
|
||
|
|
agreement, paid whatever amount of money needs to be paid in order to get that
|
||
|
|
Codex to be bundled with that operating system, and of course you're paying
|
||
|
|
that eventually when you're paying for the operating system. So there's a
|
||
|
|
business to Codex and it's a really profitable business. And interestingly enough,
|
||
|
|
a lot of people believe incorrectly that there are so many Codex out there
|
||
|
|
because each Codex is designed for a certain use. You know, one Codex must
|
||
|
|
be better than another for such and such a job, whilst another Codex must be
|
||
|
|
better than the other one for this job. That's usually not the case. While
|
||
|
|
certain Codex sometimes do have a kind of specialty or a, you know, maybe they've
|
||
|
|
been created with the intent to sell it to a certain market. It really is
|
||
|
|
just, it's usually just that. It's just someone started a company, got some
|
||
|
|
Codex together, had them make a Codex and geared it toward a certain market
|
||
|
|
because they see that there's a need for video delivery. So Codex can be really,
|
||
|
|
really uncompressed. And that's simply, like I say, that's the most pure form of it.
|
||
|
|
Uncompressed video would just be a really, really, really big file that you'd
|
||
|
|
need a really nice computer system to be able to even play back to watch. More
|
||
|
|
typically, what we find in video cameras, especially, for instance, something like
|
||
|
|
mini-dv or motion JPEG, which you'll find in some of the digital still cameras
|
||
|
|
that, you know, also have the video camera function. Not the iPhone, of course,
|
||
|
|
because the iPhone, as advanced as it is, doesn't have that function. But other
|
||
|
|
cameras, other phones even have little video cameras in them. Motion JPEG. So
|
||
|
|
that's a very, very compressed picture because obviously if you're taking it on
|
||
|
|
your phone, it's not as if though you have that much, not that much space on it
|
||
|
|
to hold, you know, video. So it's very, very compressed. Mini-dv, which is, I guess,
|
||
|
|
kind of right now it's the lowest consumer video format, is actually quite
|
||
|
|
compressed as well. And you start to see that when you bring it into different
|
||
|
|
color correction programs, starting, you know, you try to kind of isolate
|
||
|
|
certain things. It gets kind of difficult to do that with such compression
|
||
|
|
because you're losing a lot of color depth and things like that. And then
|
||
|
|
there's obviously, you know, there's like HDV, which is kind of in between
|
||
|
|
mini-dv and HD. And that's not quite as compressed, but it's compressed. So you've
|
||
|
|
got, you know, the codec by nature is to have the video on the computer. And then
|
||
|
|
there's different kinds of, there's different kinds of compression that those
|
||
|
|
codecs are applying to that video. And usually that serves a very useful
|
||
|
|
function. Like I say, if you want to take video on your camera and you don't want
|
||
|
|
to lug around a big, you know, ridiculously large digital still camera with, you
|
||
|
|
know, like an eight gig hard drive attached to it or something like a, you
|
||
|
|
know, I mean, then then you're going to have to compress that video. If you've
|
||
|
|
got a system that you want to edit video on and your system doesn't have, you
|
||
|
|
know, 10 processors and eight gigs of RAM and a gig of video RAM, then you're
|
||
|
|
going to need to compress that video so that your system doesn't totally choke
|
||
|
|
on the video that you're feeding it and demanding that it plays back to you in
|
||
|
|
real time so that you can get a feel for it so you can edit it. So the, the
|
||
|
|
codecs that compress things force a certain amount of, it's a balancing act.
|
||
|
|
Obviously, the artist part of the person taking the video ideally would not
|
||
|
|
have to compress the video at all. It would be a, a pure stream of, of basically
|
||
|
|
exactly what the camera could capture. There would be no compression. It would
|
||
|
|
just be a perfect image, a digital translation of what we see with our own eyes
|
||
|
|
basically. Realistically, on a technical side, that's just not going to happen
|
||
|
|
either because the system that you're running it on isn't going to be able to
|
||
|
|
handle it or the system that you're delivering it to isn't going to be able to
|
||
|
|
handle it. So think about internet video delivery. There's no way that you're
|
||
|
|
going to be able to send someone uncompressed video, you know, when they go
|
||
|
|
and download your video netcast or your, your movie, your open source movie or
|
||
|
|
something like that. It's just not going to be possible. You have to compress it
|
||
|
|
so that they can download it within a reasonable amount of time. But you have to
|
||
|
|
compress it only so much and you want to obviously leave it looking as good as
|
||
|
|
possible. And so it gets really, really tricky and there's a certain art and
|
||
|
|
there's a certain science to compression and it is fairly complicated to
|
||
|
|
compression. It's something that you really kind of have to get to know, but it
|
||
|
|
really helps to know what exactly is going on when you're doing the
|
||
|
|
compression. And that'll help you wrap your mind around how to go about
|
||
|
|
compressing video. So assuming we've gone out and gotten some video and we come
|
||
|
|
back and we've edited it or whatever we're going to do with it, we now, we
|
||
|
|
now need to compress it so that we can send it out to other people so that they
|
||
|
|
can actually watch it. And whether you're going out to DVD or whether you're
|
||
|
|
going to offer it as a download over the internet or you're going to compress
|
||
|
|
it onto a video CD or you're going to put it on your own media player, your
|
||
|
|
in 800 or something like that, you have to keep in mind your what you're
|
||
|
|
delivering to because of course it couldn't be that simple. Every different
|
||
|
|
device needs a different kind of compression method or could benefit from
|
||
|
|
having its own compression method. The process of encoding video or compressing
|
||
|
|
video is to take the video in its native codec whatever it was captured in into
|
||
|
|
the camera and now you're taking it and you're going to transcode it into a
|
||
|
|
format that is more ideal for whatever delivery method you've chosen. You can
|
||
|
|
do this on Linux on the command line. I think there are some GUI tools as well.
|
||
|
|
I usually just do it on the command line. However you do it you you really need
|
||
|
|
to know what the different what the important variables are because honestly
|
||
|
|
there are only a couple of a really important variables and if you understand
|
||
|
|
what they do you'll have you'll have part of what you need to understand how
|
||
|
|
you're going to go about compressing the video. The interesting thing about
|
||
|
|
compression is that only half of it is understanding what needs to be done. The
|
||
|
|
other half is actually looking at the video that you are compressing on a
|
||
|
|
case-by-case basis and kind of analyzing it with your own eyes and and kind of
|
||
|
|
processing in your own mind how that video is going to treat or how your
|
||
|
|
compression method is going to treat that video. So the idea here is that if you
|
||
|
|
have a video of people blowing up buildings and shooting lasers and
|
||
|
|
swinging around lightsabers that's going to need a pretty that's a lot of
|
||
|
|
information happening in that video frame and if you really start thinking about
|
||
|
|
video frames traditionally I think we all think of it kind of as we know film
|
||
|
|
is you know as a series of images being shown to us you know a series of
|
||
|
|
still images being shown to us at 29 or 30 or 24 frames per second and it's
|
||
|
|
simply the the illusion of motion that we have from seeing all these still
|
||
|
|
images and while technically it's it's sort of the same thing in video it's
|
||
|
|
actually a lot more helpful to think of it more like how the computer sees it.
|
||
|
|
The computer doesn't really see it as a set of still images the computer sees
|
||
|
|
it as a block of pixels and each of those pixels has a value each pixel has a
|
||
|
|
Luma value and a Chroma value the Luma value is the brightness or darkness of
|
||
|
|
that pixel and the Chroma value is the hue the color of that pixel those two
|
||
|
|
things in each little pixel is what the computer is looking at and then
|
||
|
|
think about how many pixels there are in even a standard definition frame
|
||
|
|
typically it's 720 pixels by 480 which is basically more math than I can do in
|
||
|
|
my head right now but that's a lot of pixels you know it's a lot of pixels for
|
||
|
|
the computer to think about and that is 720 by 480 approximately 30 times a
|
||
|
|
second so now you've got even more for the computer to consider so if you think
|
||
|
|
about your frames of video as just a box of pixels of ever changing pixels you
|
||
|
|
kind of just analyze the picture on that basis so if you've got people swinging
|
||
|
|
your own lightsabers you've got pixels that are changing value both Luma and
|
||
|
|
Chroma value just a lot in one second you know that lightsaber is gonna go
|
||
|
|
from one end of the string to the next that's a streak of light that that
|
||
|
|
goes across the frame but then the pixels that it has passed through are going to
|
||
|
|
go back to their old value after it passes through that area you know so and
|
||
|
|
then you've got people around in that frame and you've got sparks flying around
|
||
|
|
and you've got all that kind of stuff going on that's a lot of information and
|
||
|
|
that that kind of compression you're not going to be able to compress it that
|
||
|
|
much and be able to retain clarity and you know the high quality of image on the
|
||
|
|
other hand if you if I was filming myself right now or video taking myself
|
||
|
|
right now all we would have in the frame was me talking into a microphone and
|
||
|
|
really nothing else you know there wouldn't be a whole lot of movement I'm
|
||
|
|
not I'm not really moving around it's just my lips removing and if I even could
|
||
|
|
seal my lips behind the microphone the video camera wouldn't even see
|
||
|
|
that much and so it would it would practically be like a still image and so
|
||
|
|
that's that's a lot of that's a lot of pixels that basically aren't changing
|
||
|
|
value and that kind of stuff is very easy for the computer to compress and it's
|
||
|
|
very easy to have a you know to give that kind of frame a very small amount of
|
||
|
|
what's called bitrate so I've probably given you enough to think about for this
|
||
|
|
episode I'm going to wrap it up now and I'm gonna do a second episode in which we
|
||
|
|
will go through what exactly is happening during during compression and what
|
||
|
|
those important variables to think about are so that you can kind of get a
|
||
|
|
sense of what you should be thinking about when you set about compressing
|
||
|
|
video and then probably in the third and probably final episode I will tackle a
|
||
|
|
couple of different codecs and talk about what they all are and why they
|
||
|
|
exist and who owns them and what we should do to deal with them
|
||
|
|
thank you for listening to H.P.R.R. sponsored by caro.net so head on over to
|
||
|
|
H.P.R.O.N.C. all of us in here
|