Help with all this digital stuff?

Paul Mather paul at GROMIT.DLIB.VT.EDU
Wed May 12 10:23:46 EDT 2004


On Thu, May 06, 2004 at 05:07:45PM +0100, M Holmes wrote:

=> OK, that makes sense. So what bitrate would give CD quality? The lowest
=> bitrate for MP3 seems to knock nearly 90% off the filesize. Presumably
=> that means the quality is quite poor? What do others use as the
=> reasonable compromise on portable players?

Actually, the lowest bitrate for MPEG audio would knock more than 90%
off the filesize.  Normal linear PCM audio (as on a CD) consists of
16-bit stereo samples at a sample rate of 44.1 KHz.  So, that's a
bitrate of 44100*16*2 = 1411200 bps of data.  Here are the supported
bitrates for MPEG layer 3 audio:

MPEG-1   layer III sample frequencies (kHz):  32  48  44.1
bitrates (kbps): 32 40 48 56 64 80 96 112 128 160 192 224 256 320

MPEG-2   layer III sample frequencies (kHz):  16  24  22.05
bitrates (kbps):  8 16 24 32 40 48 56 64 80 96 112 128 144 160

MPEG-2.5 layer III sample frequencies (kHz):   8  12  11.025
bitrates (kbps):  8 16 24 32 40 48 56 64 80 96 112 128 144 160


So, for 44.1 KHz audio, the lowest bitrate is actually 32 kbps.  That
amounts to more than a 97% saving over the original audio stream
size.  If you were also prepared to downsample (say to 22.05 KHz), you
could use an 8 kbps bitrate (MPEG-2 layer 3) for a greater than 99%
reduction in size compared to the original uncompressed audio.

Of course, I'd only recommend such low bitrates for _Bring Me the Head
of Yuri Gagarin_... :-)

The quality loss depends upon several factors, which includes these,
amongst others: target bitrate, encoder bandpass filtering, encoder
subsampling, encoder psychoacoustic model employed, constant
vs. variable bitrate, etc..  All of these (except constant
vs. variable bitrate) trade off audio quality for encoded file size.

As Doug pointed out, certain types of music are easier to compress
than others without obvious audible quality loss.  As a general rule,
studio material compresses better than live audience recordings.  A
big reason for this is that the room ambience in an audience recording
is more complex noise than the recording studio ambience (where great
pains are taken to remove extraneous, unwanted noise sources).  Noise
is a source of randomness, and randomness does not compress well (by
its very nature).

In addition, the subband coding approach of MPEG audio compression
allows you to treat different parts of the audible spectrum with
different encoding fidelity.  (A simple way of thinking of this is to
view the encoder like a "graphic equaliser" where the heights of the
slider for that portion of the frequency range represents how many
bits from out of the bitrate will be allocated to encode that
portion.  The more bits allocated, the better the quality.)  So, if
you wanted more detail in the midrange, you could devote most of your
bitrate to that section of the audible spectrum.  One famous (and
dominant) MPEG encoder notoriously cheated to obtain great compression
by filtering out entirely all audio above 16 KHz.  Because that was a
huge source of noise, leaving it in and compressing it lowered the
compression ratio. :-)

So, what encoding bitrate to use?  Note that the highest is 320 kbps,
which is actually only 40 Kbytes/s.  (Uncompressed CD audio is ~176
Kbytes/s.)  The 320 kbps bitrate was used in blind listening tests by
industry "golden ears" and was apparently adjudged acceptable (i.e.,
not distinguishable from the original uncompressed CD audio).  In
other words, even at the highest bitrate (quality), you're going to
see a big reduction in encoded file size.

For my encoding, I use LAME in high-quality variable bitrate (VBR)
mode, allowing the bitrate to vary between 128 and 320 kbps.  When I
encoded a bunch of Bevis Frond studio material for a listening CD, it
seemed that the average bitrate ended up at 224 kbps.  (LAME actually
outputs a histogram showing the distribution of bitrates used across
encoded frames.)  The encoded files sound great, IMHO.

Actually, LAME supports an average bitrate (ABR) encoding mode where
you can tell it to aim for a target average bitrate used.  It uses VBR
encoding, but chooses the bitrate for each frame such as to head
towards the desired average.  LAME has several "preset" ABR modes, as
follows:

>>>>>
A few aliases are available for ABR mode:
phone => 16kbps/mono        phon+/lw/mw-eu/sw => 24kbps/mono
mw-us => 40kbps/mono        voice => 56kbps/mono
fm/radio/tape => 112kbps    hifi => 160kbps
cd => 192kbps               studio => 256kbps
<<<<<

This may serve as a guide to choosing encoding bitrates depending upon
input source.

=> EAC? It can do this on the fly?

EAC = Exact Audio Copy.  This is the most respected CDDA extraction
program for Windows when used in Secure mode and after having had the
sector offset correctly calibrated.  It has also mushroomed into an
audio burning program now.  It can do the CD -> MPEG compression on
the fly.

=> Ah. So the best I might be able to hope for is to plug in a flashcard to
=> the HDD/DVD recorder and transfer a movie (how fast are flashcards?
=> Would I get a whole movie on one? Do these thing allow editing where I
=> could split a whole move (MP2?) file into smaller files for transfer?)
=> to it; then plug the flashcard into the Archos and do a transfer; then
=> plug in the Archos as a portable drive on my computer and run an MP2 to
=> MP4 converter program (do these even exist?). Or would I be better just
=> recording a movie in realtime to the Archos?

Does the Archos have a FireWire (IEEE 1394) connection?  That is the
de facto standard for digital video, and can often be found on digital
camcorders for download of digital video.  It would be better for
moving around digital video.  I'm not sure how big flash cards are
these days, but "less than a gigabyte" springs to mind.  (128 MB and
256 MB USB "pen drives" seem very popular around here.)

As for the "would I get a whole movie on one," it depends upon how it
was encoded.  Again, like audio, digital video is a tradeoff between
perceptual quality and encoded file size.  For one, just the
dimensions of the picture frame will have a big impact on the size of
the encoded movie: a 640x480 pixel frame size will require a lot more
space than a tiny 160x120 pixel frame size.  The larger the frame
size, the more detail you will be able to capture (but the more space
it will require).  There are a bunch of standard frame sizes, governed
by all kinds of things such as adherance to broadcast standards,
whether the pixels are square or not, and widescreen vs. normal aspect
ratios.  As you mentioned recording VHS, it might be handy to use the
VCD encoding parameters, which I've heard said is aimed at "VHS
quality."  (VCD is 352x240 for NTSC, 352x288 for PAL.)  There is a
handy reference table of standard frame sizes at
http://www.mir.com/DMG/aspect.html

The type of codec also plays a large part in the encoded file size.
MPEG-4 proprietary codecs may be able to achieve higher compression
ratios, but they are less standard than, say, MPEG-2, and your encoded
film may not play on someone else's machine if they lack the codec.

As an example of the difference it can make in size, consider
everyone's favourite film, _Reefer Madness_, available for download
from the "Feature Films" area of the "Moving Images" section of the
Internet Archive (www.archive.org).  It has a running time of
1:08:17.  They offer it for download in various formats with different
sizes:

256Kb MPEG-4: 177.9 MB
MPEG-2:       2.7 GB
MPEG-1:       371.3 MB

So I guess "format matters" where size is concerned. :-)

BTW, as an alternative to the Archos for video, have you considered
just buying a graphics card with a TV-in/out for digital video capture
and playback purposes on your existing PC?  (They are cheap and
standard these days.)  A friend's desktop PC has a nVidia GeForce4
MX/440 with TV-in/out, and I used it to record an old VHS recording
she wished to preserve.  I connected the video out of my VHS VCR to
the video in of the graphics card, and the audio out of the VCR to the
audio in of the PC's sound card.  I then used video capture software
to record the VHS playing to the PC hard drive.  I just recorded it
directly to MPEG.  If I were going to do any kind of editing on it, I
would have recorded it using a "lossless" codec like HuffYUV so as to
minimise editing-induced quality loss.  Then, after doing all the
editing, I'd have done a high-quality MPEG encoding.

As you probably use Windows, you can use free software like VirtualDub
to do capture and video transformations (like de-interlacing, noise
cleanup, logo removal, etc.) via the many available plugins.  There
are also lots of tutorials for VirtualDub that also give handy tips
and guides on doing video capture without frame drop and editing
whilst maintaining good quality.  There is also a free Windows utility
called VirtualVCR that is aimed at easy high-quality video capture.

Given the large amounts of storage space digital video consumes, and
the cheapness of PC hard drives, a PC-based digital video solution
might be the cheapest and most flexible.  Of course, unlike a hardware
solution aimed at the consumer market, it may require a slightly
higher learning curve.

Cheers,

Paul.

e-mail: paul at gromit.dlib.vt.edu

"Without music to decorate it, time is just a bunch of boring production
 deadlines or dates by which bills must be paid."
        --- Frank Vincent Zappa



More information about the boc-l mailing list