The K-Zone: Using the transcode utility on Linux to rip DVDs for the Archos AV500 (and similar devices)
[Updated January '07 to deal with 16:9 content presented anamorphically in
a 4:3 frame]
This article explains how to use Thomas Oestreich's `transcode' utility,
which is available for most flavours of Linux, to rip DVDs
to play on the Archos AV500. While the AV500 will play a variety of
video frame sizes, I'm assuming here that you want to optimise the
video file so it fits exactly -- or as exactly as possible --
on the AV's 480x272 screen. As we shall see, it won't always be possible
to get a perfect fit, and compromises will have to be made.
I assume in this article that you want to rip DVDs to watch on the
internal LCD screen, not on an external video display. The AV500 is quite
tolerant of a wide range of video frame sizes, so if you ripped
a DVD into an MPEG4 file with a fairly large frame size (e.g, 640x480)
it would probably play OK on both an external display and the LCD. However,
if you just want to play on the
internal screen, you can do a lot better -- you can size it to fit
the LCD, and get the best compromise between file size and image
quality.
Because the AV500 has such an amazing screen, it's worth spending a bit
of time and effort getting things just right. This is where transcode
comes in -- because it allows for incredibly fine control over all
aspects of the format conversion, if you have the patience you can
achieve far better results than are obtainable by point-and-click
converters. In addition, because there's no graphical interface, all the
CPU power goes into crunching the data, so the job gets done quicker
(but it's still time-consuming, even on fast hardware).
The disadvantage is that transcode is fiddly to use, and takes some
getting used to. However, once you've figured out which settings work for
you, you've done all the hard work, and after that it's easy.
This article also provides some background on how DVDs are encoded,
in the hope that it will help the reader deal with situations that aren't
specifically covered here.
Please note that I only have much experience with PAL DVDs. The image
sizes and frame rates are slightly different with NTSC, so you'll
need to calculate accordingly. I'm assuming also that the reader is
tolerably familiar with Linux and the use of the command line -- if you've
never used a sophisticated command-line utility before, I venture to suggest
that getting stuck into transcode is not the way best way to learn.
If the idea of using a command line brings you out if a cold sweat,
read no further -- there
are no shortage of point-and-click converters out there.
What follows applies to devices other than the AV500, provided they have the
same, or at least similar, screens. That includes the more recent Archos 504
and 604, as well as the Sony PSP. This article doesn't really apply to the
PMA430 or to the newer Archos 404, because these units have 4:3 screens.
Background
Regardless of how they are intended to be displayed, all PAL DVDs
are encoded at a frame size of 720x576 pixels, 25 frames per second (fps).
All, without exception. The aspect ratio of this frame is 1.25:1, or 4:3
as it's
usually expressed. I'm going to call this frame the physical frame.
However the programme material is encoded, and whatever the aspect
ratio of the actual
programme presentation,
the physical frame remains the same, and the presentation has to be
inserted into it wherever it will fit most comfortably.
The 720x576 physical frame is approximately the shape of most TV
screens and computer monitors. So if you're ripping a DVD that is intended to
be shown on a 4:3 screen, and you have a 4:3 screen, you don't have to
worry any more about aspect ratio. All you have to do is to shrink
the picture down by scaling the width and height by the same factor. The
AV500, however, has a 16:9 screen. It will show a video file encoded with a
4:3 aspect ratio, but it won't fill the screen unless you take certain
steps -- more on this later.
Although all PAL DVDs have a physical frame of 720x576 pixels,
there are two different `encodings':
4:3 encoding, and 16:9 encoding. In 4:3 encoding, image data fills the
entire physical frame. The studio will use this encoding for programmes
that are indended for 4:3 displays -- television series, for example.
The intention is that the programme will be displayed in approximately
the same (4:3) aspect ratio as the DVD frame size. Ripping this kind
of DVD is generally quite straightforward, because you don't
need to worry about aspect ratio that much.
Movie studios will use 16:9 encoding for most wide-screen presentations,
whatever the final aspect ratio is intended to be on the display. In the
first version of this article, I said that 16:9 encoding was used for
[i]all[/i] widescreen presentations but, since then, this situation has changed.More on this point later.
In 16:9 encoding,
the program image is placed into the middle of the physical frame,
leaving some blank areas at the top and bottom. In most cases the blank
areas are about 85 pixels high both above and below the image.
This leaves an image area about
406 pixels high in the middle of the 576-pixel-high physical frame. Note that
720/406 is approximately equal to 16/9, hence the designation `16:9
encoding'.
The simplest wide-screen situation to consider is where the programme
itself is presented with 16:9 aspect ratio, and the DVD is encoded
as 16:9. To talk about `encoding' here is to give the process a
grandeur it doesn't really deserve -- all the studio is really
doing is taking the 16:9 picture, and putting it into the DVD's
physical frame where it fits best -- across the middle.
It is important to realize that if the programme itself is of
16:9 aspect ratio,
and you play a DVD of that programme
on a 4:3 display device,
the aspect ratio as it is displayed is [i]still correct[/i]. Remember that
DVD technology was developed for use with the humble television set,
not the whizzbang gadgets we've got these days, so it has to be possible
to play most programme formats without any messing around with the aspect
ratio. Television sets have not been able to do this kind of thing
until recently.
Of course, if you do show a programme encoded this way on an ordinary
television or 4:3 monitor, what you'll see is a wide image on a square-ish
screen, with black bars at the top and bottom. This is not an defect:
a 16:9 presentation does not fill a 4:3 screen, and that's the end
of the matter.
Now, if you have the good fortune to possess a 16:9 display device, you
should be able to watch the presentation so that it fills the entire
screen. All you need to do is to throw away the blank areas at the top
and bottom of the DVD frame, and then scale the image uniformly.
Because the programme is of 16:9 aspect ratio, and the display device
is of 16:9 aspect ratio, the programme should fit perfectly on
the display, with no black bars. The scaling we need is about
30% -- we need to make 406 vertical pixels fit into a space normally
occupied by 576 pixels.
I said earlier that you can't make a 16:9 picture fit a 4:3 screen,
which is true as far as it goes -- you can't make it fit without
losing some of the programme image. But what happens if you apply
the same scaling on a 4:3 screen, as works on a 16:9 screen? You
will end up with an image that is too big for the screen -- it
will fill the vertical area, but some of the left and right edges
will be `off the screen' -- they just won't fit. However, for
many people the resulting image will be better than one with black bars:
most of the action will be in the middle of the frame anyway.
There is a similar problem if you want to fit a 4:3 programme into a
16:9 display. This time you will normally see black bars at the
sides of the display, because the programme is not as wide
as the display device. If you scale the image by 20% in both directions,
you'll fill the width of the screen, but some of the top and bottom will
be off the screen. Again, many viewers will find this preferable to
watching the picture with black bars to the left and right, and
most widescreen TV's have a facility to do this scaling. The
AV500 -- which has a 16:9 screen -- also offers such a facility.
To sum up... if we have a 16:9 output device (like the AV500 screen), and we
have a DVD encoded as 16:9, and a 16:9 programme, we don't have to change the
aspect ratio at all. We just scale the width and height equally to give the
right pixel size for the screen. Optionally we crop off the black bars at the
top and bottom of the physical frame, because there's no point filling the
ripped file with black bits we aren't going to watch.
If we have a 4:3 programme on a DVD encoded as 4:3, we can do essentially
the same thing -- we scale the DVD physical frame uniformly so that
the height of the resulting image is the height of the display
device. We can't match the width as well, because the aspect
ratio of the display device (16:9) is not the same as the aspect ratio
of the programme (4:3). We can watch the ripped 4:3 prorgramme either with
black bars at the left and right, or we can ask the display device to
scale up so that the image fills the frame, and accept that we'll lose
some picture at the top and bottom.
If you want to be really sophisticated, you can compromise between black
bars and picture loss at the top and bottom. So, for example, rather
than scaling so that the entire display screen is full, you could scale to
reduce, not remove, the black bars, and lose a bit less of the
picture at the top and bottom. This is a matter of taste. Most
display devices aren't clever enough to do this `variable' scaling
operation -- the AV500 can't -- so if you want to try this, you'll
need to do it using the appropriate transcode settings.
In any event, the important thing to realize is that in none of the operations
described above had we had to worry about aspect ratio conversion --
the ripped image has the same aspect ratio as the physical frame in
all cases.
I will point out in passing -- completely off-topic, and only because
it's a hobby-horse of mine -- that whatever artistic
arguments might be offered
in favour of wide-screen presentation, wide-screen DVD formats do not
offer higher-quality images. Or, at least in so far as quality is
measured by the amount of pixel data in the image (and it usually
is -- look at digital camera reviews). All 16:9 encoding formats
contain 30% fewer pixels than 4:3 formats. The `quality' is
therefore worse. But that, as I said, is beside the point.
So now we move on to the real trouble-spot -- `anamorphic' DVD
presentations. These are presentations that are intended to be
played at a different aspect ratio from that of the physical
frame. Remember that the aspect ratio of the physical frame is
always 4:3, and even a 16:9 programme retains this aspect ratio,
by the simple expedient of what amounts to padding it out at
the top and bottom to make it fit the physical frame.
Anamorphic formats are hard to explain in abstract terms, but easier
-- I hope -- by example. Consider a typical cinematic movie presentation, with
an aspect ratio of 2.35:1. People often think that 2.35:1 is the same
as 16:9, for the simple reason that you often see the two things
written side-by-side on the back of a DVD sleeve. But, in fact, 16:9
is 1.78:1. So 2.35:1 is much wider than 16:9. Now, we already
know that the physical frame of a DVD cannot change, and we already
know that only two encodings are supported -- 4:3 and 16:9. So how
do we accomodate 2.35:1? Well, one method would be to proceed
in the same way that 16:9 is accomodated. We'll just put the programme
image into the middle of the physical frame, fitting it as best we
can. If we do this, we find that we need to make the programme
image 306 pixels high (720/306 = 2.35 or thereabouts).
We can encode a DVD like this, and if we have one it is very easy
to display (and to rip, for that matter) because, again, we aren't worried
about aspect ratio.
But remember what I said earlier about the image quality of widescreen formats?
If we encode a 16:9 presentation in a 4:3 physical frame, we lose about 30%
of the image pixels. But if we put a 2.35:1 presentation into a 4:3
physical frame, we lose 46% of the image pixels. The best-fit
image size will be 306x720 pixels, and the
quality to will be about the same as that of a VHS tape!
Admittedly, it's going to be the same as a pristine VHS tape direct
from the studio, not a dodgy one that's been copied about five times and
has blank patches in the tape oxide; but all the same it's not going
to be `DVD quality' in spirit.
To get around this problem, the studio will usually distort the aspect
ratio of a wide-screen (wider than 16:9) presentation so that it fills
the same part of the physical frame as a 16:9 presentation would.
That is, instead of encoding the programme as 306x720 pixels,
-- required to maintain the 2.35:1 aspect ratio -- it is encoded as 406x720, as
a 16:9 presentation would be. We get an extra hundred vertical pixels
in each frame -- and therefore a much better image quality --
but at the expense of a distorted aspect ratio.
You might be wondering why, if we're prepared to distort the aspect
ratio at all, why not go the whole hog an put the 2.35:1 movie
into the whole physical frame? Since we've got to correct the aspect
ratio on display anyway, why does it matter how much we distort it?
We'd certainly get better-quality images if we did this. The answer
lies in a consideration of what DVD was originally intended for --
it was designed for showing movies on bog-standard television sets.
If your television set cannot do aspect ratio correction, then if
you watch a 2.35:1 movie which has been stretched vertically to
be 16:9, it won't look too bad. You'll find that people look a
bit skinnier than usual, but the picture will be watchable. However
if you try to watch a 2.35 movie that has been stretched to 4:3, and
you can't correct the aspect ratio, you're going to be in trouble
-- the picture will be ghastly. In short, we stretch a 2.35:1 movies
to 16:9, not 4:3, because we can't be sure that the display device
will be able to correct the aspect ratio. There might be some DVDs
out there which are encoded in this `extreme anamorophic' manner,
but I've never come across one. In reality, nearly all DVD movies
are in `anamorphic 2.35:1' format. That is, they are stretched
vertically to fill an image 406x720. When you rip the movie
to a video file, you will have to compress the image vertically
more than you compress it horizontally, so that it ends up
back at the correct aspect ratio.
Recently (that is, since the first version of this article) studios have
started releasing DVDs with a 16:9 presentation encoded anamorphically
as 4:3 (rather
than encoding as 16:9 with black bars). While you can't really get away
with encoding 2.35:1 as 4:3 (because the vertical stretch is too much for
a television set), we can just about get by encoding 16:9 as 4:3. OK, so
everybody looks seven feet tall, but it's watchable.
There are a few DVD movies that are even wider than 2.35:1.
This does not present a problem
when ripping, because the DVD will be intended to be played on
equipment that can handle 2.35:1 anamorphic, so if you proceed on
the basis that it is 2.35:1 anamorphic you'll get good results.
If you want to be sophisticated you can shave a few megabytes off
the rip by cropping off the thin black bars (as described below).
The other movie presentation format you need to know about is
Academy Standard (called `Flat' in the trade), which has an
aspect ratio of 1.85:1. This is almost 16:9, but not quite -- it's a
little wider. This will probably be put on a DVD as if it were 16:9,
so you should be able to proceed as for a true 16:9 programme.
However, some studies encode this material anamorphically as 4:3.
In practice, if you proceed on the basis that it is a 16:9 presentation,
either encoded 16:9 or anamorphically as 4:3, you'll be OK.
To sum up... most PAL DVD movies are presented in one of four ways:
- 4:3 programme content in 4:3 encoding -- when you rip this
for the AV500 (or any other 16:9 display) all you'll need to do is to scale
the physical frame uniformly to fit the display's height.
The AV500 will either black-bar the sides, or zoom to fill the
display, depending on how you want to watch
- 16:9 or Academy Standard
programme content in 16:9 DVD encoding -- this will
need to be cropped at the top and bottom, then scaled uniformly to fit the
height of the display (it will automatically fit the width if you
fit the height, because the aspect ratio of the AV500 is the same
as that of the programme)
- 2.35:1 programme content in 16:9 DVD encoding (therefore anamorphic).
This will need to
be cropped, then scaled anamorphically to fit the screen and
correct the aspect ratio
- 16:9 or Academy Standard program content in 4:3 encoding --
this must be scaled anamorphically to fit the screen and correct
the aspect ratio. No cropping is necessary, because the material fits
the 4:3 physical frame
Other programme formats will usually be put into one of these encodings and,
if you choose the nearest one, you won't go far wrong.
A problem that you will encounter when ripping any DVD is that the
studios don't normally put any technical information on the packaging.
It's very rare (to say the least) to find a DVD sleeve that says
``This movie is presented in an aspect ratio of 2.45:1, encoded as
16:9, with 402 vertical programme scan lines and 87 blank scan lines
above and below the programme content. The image is compressed
vertically by 30.1% over the horizontal''. If they did, we could write
a piece of software that would use that information to rip a DVD with
no trial-and-error at all. Alas, what you'll see on the sleeve is
something like ``Wide-screen presentation'' or ``Enhanced 16:9'' --
which are meaningless terms. You might need to try a few
different ripping protocols until you get the one that produces the
best results. After all, the best rip is the one that looks
best when you watch it. It is nearly always necessary, in my experience,
to rip part of the DVD first without any kind of transformation
at all, to get an idea how it is presented and encoded.
An overview of transcode
transcode is a command-line utility for converting one AV format to
another, with modifications in the size, aspect ratio, interlacing,
frame rate, etc., as required. transcode can operate directly from a DVD --
you don't need to extract the DVD to MPEG files or even VOBs first.
Transcode can do single-pass or multi-pass encoding; I'll assume
initially that you want to do single-pass encoding, and explain
how to adapt the technique to multi-pass at the end.
A basic transcode command looks like this:
transcode -a 0 -T NN,-1 -x dvd -i /dev/dvd -w NNN -b N,N,N \
-V -f N -j NN,NN,NN,NN -B NN,NN,NN -y divx4 -I 1 \
-o outputfile.avi
All the `NN's are to be replace by numbers according to how you want to
do the rip. Here's what the command-line arguments mean.
-a 0 Rip audio track 0. Your DVD might have multiple
audio tracks (different languages, or commentaries, for example), and
there's no
obvious way to tell which is which. You'll need to try a few until
you get the right one. Note that transcode will automatically extract
a stereo soundtrack from a mutli-channel one, so you don't need to
do anything special here
T NN,-1 Rip title number NN. Usually title numbers start
at 1, and increase in steps of 1. But don't bet on it. You might need to
try a few different title numbers until you get the right one. The
`-1' part tells transcode to read all the chapters in the title and
put them in the same output file. Movies are usually put into a single
title -- even that Behemoth The Two Towers has all three hours in
a single title. DVDs of television series usually put each episode in a
single title
-x dvd The input source is a DVD
-i /dev/dvd The input source is at /dev/dvd
-w NNN Target bandwidth in kilobits per second. For the
internal LCD display, 500 works reasonably well. You can get away with much
lower values if what you want to do is squeeze as many movies onto the
hard disk as possible and you aren't too fussy about quality
-b N,N,N LAME MP3 encoder parameters: bitrate, VBR flag, quality, and mode. See the transcode documentation for full details, but for movies I usually specify -b 128,0,0,0. This gives a constant-bitrate audio
encode, which the Archos units seem to prefer. Although they have improved
in recent versions, there have been problems in the past with variable
bitrate audio tracks. Archos units prior to the 604 only support MP3 audio, so you
have to use the LAME encoder in transcode
-V Do colourspace arithmetic in YUV format. This is much
faster -- always specify this switch unless it breaks something [Note
that this is the default for the latest releases of transcode]
-f NN Output frame rate. Only specify this if you're actually
changing it
-j NN,NN,NN,NN Clip the source image by NN pixels from the top, left, bottom, and right respectively. Much more on this switch below
-B NN,NN,NN,NN Indicates how much to reduce the image size. More below.
-y divx All the Archos units support DIVX, and the more modern
ones support Xvid as well. The results are similar, but some people
prefer one or
the other. Using divx gives better compatibility [Update: probably
not true any more, and the divx codec is no longer maintained.
Use `-y xvid' instead]
-I 1 De-interlacing mode. PAL DVDs are usually encoded in such
a way as to be played on an interlaced display
(the bog-standard television set).
LCD displays are not usually interlaced -- the AV500's is not. The picture
will look horrible unless you de-interlace. Look in the documentation for the
different de-interlacing modes -- I normally use mode 1 for the internal
LCD
-o outputfile.avi The AVI file you want to write
Most of these switches have values that, once you've decided what is to
your taste, you won't need to change again. You might, for example, decide
that you can live with a monoaural audio track to save disk space, in which
case you'll need to adjust the -b switch accordingly. You may
want to experiment with the -w bitrate setting. In any case,
once you've decided what suits you best, you shouldn't need to vary these
very much from DVD to DVD. What you will need to change are the
-B and -j switches.
-j tells transcode to crop a certain number of lines and columns
from the top, left, bottom, and right of the source frame (the source
frame, in this case, is always 720x576 pixels). In practice, you
won't normally need to crop the left or right of a DVD, and the
amount to crop from the top and bottom, if any, is usually the same.
If you calculate that, for example, you need to crop 84 lines from the
top and bottom of the source image, you'll say
-j 84,0,84.0
(but see the transcode manual for how this command can be abbreviated
in certain circumstances).
-B is the fiddly one. This switch controls transcode's
`fast downscaling' algorithm. Bear in mind we're taking about `fast'
in the context of ice ages here -- ripping a DVD is never a fast
operation. But it's fast compared to doing a full downscale
using the -Z switch, and
the quality does not seem to be noticeably worse, so it's worth
getting the hang of -B. More recent versions of
transcode can calculate the -B parameters automatically,
but it's better to do it yourself because you can be sure you know
what the result will be.
The paramters to -B are the number of pixel groups to
remove from the image to downscale it:
-B blocks_to_remove_vertically,blocks_to_remove_horizontally,block_size
The block_size can be 8, 16, or 32. The larger the block size, the
quicker it works, but the limitation is that the source image size
must be an exact multiple of the block size. Otherwise you'll get
an error message. In my experience it's easiest to work with
a block size of 8 all the time, and that's what I assume in all the examples.
Suppose you have an image that is 720x576 pixels, and you want to
downscale it to 344x272, work out the -B values as
follows.
Number of vertical lines to remove is (576-272) = 304
Number of vertical pixel groups is (304/8) = 38
Number of horizonal columns to remove is (720-344) = 376
Number of horizontal pixel groups is (376/8) = 47
So we need `-B 38,47,8'.
:
And that's all (!) there is to it, but bear in mind that -B is
applied after -j, so the image that is downscaled
is the cropped image, not the original. Armed with this information we can
proceed to look at some real examples.
And so to business
Here are some examples, based on the DVD formats described above. You may
want to experiment with different values of -w and -b
to get the compromise you want between file size and image quality.
4:3 programme material
4:3 programme material will always be encoded at 4:3 aspect ratio,
filling the full physical frame. We need to downscale this material
to fit the height of the AV500 screen, which is 272 pixels.
If we scale uniformly, we want a target frame size of 344x272 pixels
(note 344/272 = 720/565 = 4/3 -- we aren't changing the aspect ratio).
We already know the -B values (computed above), and we don't
need to
clip the source at all (so no -j). So the transcode command
we need is:
transcode -a 0 -T NN,-1 -x dvd -i /dev/dvd -w 500 -b 128,0,0 \
-V -B 38,47,8 -y divx4 -I 1 -o outputfile.avi
The only thing you'll have to experiment with is the -T
switch, to make sure you get the correct titles off the DVD. The
`-V' is not required on the latest versions of transcode, and you'll get
a warning message if you specify it. [Update: `-y xvid' is generally a
better choice these days, as the divx4 codec is no longer maintained.]
Because we are dealing with Linux here, there's nothing to stop you
watching the generated outputfile.avi using mplayer
or whatever, while it is being generated (so long as your computer
is fast enough). So if it turns out that you're grabbing the wrong title,
you can stop transcode and try again. If it's correct, just leave it
to run. Don't forget to ensure that you've got the right audio track
as well.
Note that the resulting 344x272 image won't fill the AV500 screen, but
the unit will scale the image to fill the screen (chopping off a bit
of the top and bottom) if you ask it nicely.
16:9 programme material, not anamorphic
This will generally be encoded as 16:9, that ism with 84 blank lines above
and below the programme content. We need to clip off these 84 lines
first, which will give a working frame size of 720x406 pixels.
We want to reduce this to 480x272 -- the exact size of the AV500
screen -- but we can't; at least, we can't with fast downscaling.
We would need to remove 134 lines vertically (406-272) but we can't,
because 134 is not a multiple of 8. So, instead, we'll remove
136 lines (136 is 17x8), giving a final frame height of 270.
To fit the screen width, we need to remove 240 columns (=30*8).
So the -B values are 17,30,8:
transcode -a 0 -T NN,-1 -x dvd -i /dev/dvd -w 500 \
-b 128,0,0 -V -j 84,0,84,0 -B 17,30,8 \
-y divx4 -I 1 -o outputfile.avi
As before, put in the correct value for the title number.
The final frame size will be 480x270 pixels.
2.35:1 programme material, encoded anamorphically in 16:9
We can do this in two ways. If you remember from the discussion
above, the reason the studio stretches 2.35:1 material to fit
a 16:9 frame, and not a 4:3 frame, is that if you dont'
correct the aspect ratio it doesn't look too bad, and most
TVs can't do aspect ratio correct (or, at least, could not do so
when the DVD format was introduced). So one way you could
proceed with this kind of programme material is to treat it exactly as 16:9
programme material, as described in the previous section. You'll
end up with an image size that will almost exactly fill the AV500 screen,
but of course it will be stretched a bit vertically -- the
AV500 screen is too tall for a 2.35:1 source to fill it without
stretching.
If you prefer the original aspect ratio of 2.35:1, you'll have to
put back the black bars at the top and bottom of the image. The easiest way
to do this is to crop the image to a size that will give the correct
aspect ratio, and let the AV500 centre it on the display. You don't need to
insert the black bars into the output file, although transcode does
provide a facility for this if you need to. Since the width of the
AV500 screen is 480 pixels, the height required to give a 2.35:1
aspect ratio is 204.26 pixels. We can't have fractional pixels and,
in any case, for fast downscaling we need to remove an integral number
of 8-line groups. If we aim for a final image size of 480x208,
this will give an aspect ratio of 2.31:1, which is close enough for
practical purposes. If you want it spot-on, you'll need to use the
slow (-Z) downscaling method.
As for 16:9 programme material, we still need to strip 84 lines
above and below the image -- because
they will be empty. But instead of scaling down to 270 lines,
we will scale down to 208. So the only difference between this
case and the previous one is the first argument to -B,
which will be 25 (because (576-(2*84)-208)/8 = 25):
transcode -a 0 -T NN,-1 -x dvd -i /dev/dvd -w 500 \
-b 128,0,0 -V -j 84,0,84,0 -B 25,30,8 \
-y divx4 -I 1 -o outputfile.avi
The final frame size will be 480x208 pixels.
16:9 programme material, encoded anamorphically in 4:3
As I said before, this is increasingly common, probably because everybody
now realizes that encoding as 16:9 throws away 30% of the frame.
We don't need to crop, but we do need to scale anamorphically to
480x272. This is the one case where I use -B with a 16-pixel group size,
because I can still get an exact fit and exact scaling:
transcode -a 0 -T NN,-1 -x dvd -i /dev/dvd -w 500 \
-b 128,0,0 -V -B 19,15,16 \
-y divx4 -I 1 -o outputfile.avi
The final frame size will be 480x272 pixels.
Academy Standard (1.85:1) material is also often encoded this way, and can
be processed using the same command. However, you'll get some thin black
bars around the picture which you might want to crop off, if you're really
fussy. I normally don't bother.
Two-pass encoding
In all the examples above, we have used one-pass encoding. Two-pass
encoding will give a considerable increase in image quality for a given
file size, or a smaller file for a given image quality. Of course,
it will take nearly twice as long. In my view, the AV500 display
is sufficiently good that it's worth the extra time to do a two-pass
operation. Here's how.
On the transcode command line, for the first pass add the switch
-R 1 to the command lines given above. For the second pass,
add -R 2 instead of -R 1. And that's it.
Using this method, both passes produce a video file -- if you're using
the command-ine arguments described in this article. This is fine if
you're in a hurry to watch -- you can watch the first pass while the
second is encoding. However, the only necessary output from
the first pass is the file divx.log, which contains
transcode's calculations of the frame-to-frame variablility. It
is this information which drives the variable bitrate encoding
in the second pass. So if you want to get the fastest two-pass
rip, you should dump the video output from the first pass, and
stop the audio being encoded at all. So instead of
-o outputfile, say -o /dev/null; and
instead of -y divx, say -y divx,null.
Note that the transcode xvid codec, unlike divx4, does not benefit from,
or support, multi-pass encoding.
New Archos models
Since the first version of this article, Archos has released three new
models: the 404, 504, and 604; and more are rumoured to be coming.
The 504 and 604 have the same screen geometry as the AV500, while the
404 has a TV-shaped 4:3 screen.
But there are two other developments in these later devices which are
potentially important. First, they support formats other than MPEG4, and MP3,
and file types other than AVI. I find AVI and MPEG4 satisfactory for the
built-in LCD, so I still use them. But for optimal image quality you might be
better investigating MPEG2 format. The 504 and 604 will, in fact, play a direct
rip of the MPEG stream out of the DVD (so the ripping process consists only of
format conversion, not encoding, and is therefore very fast). However, ripping
this way results in vast files, which aren't all that suitable to a portable
device.
The other development is support for multi-channel (e.g., 5.1) audio. Of course
you can't usefully listen to 5.1 audio on headphones, but if you have a docking
station and a compatible 5.1 amplifier, you can use the S/PDIF (coaxial)
digital audio output. Since MP3 is limited to stereo, you can't rip your
DVD audio tracks to MP3 if you want to take advantage of this feature.
AC3 is probably a better bet.
Closing observations
Here are a few final things to think about.
Make usage decisions carefully Ripping DVDs is not a quick
process, even on the fastest computer hardware. It's not quick
enough, at any rate, that you'll want to do it twice for the same
programme. If you plan on
watching your programmes on a larger device than the AV500 screen,
it's probably best to take that into account when ripping. After all,
the AV500 will play larger frame sizes than its own screen. For
best results, consider ripping to a size which is of the same aspect
ratio as the LCD screen, e.g., 720x406. This is a relatively fast
thing do to with transcode, because you haven't got to scale the
image at all -- just crop out the 406 lines from the middle of the
physical frame. Similarly, if you always prefer to crop off
a part of the image
rather than having black bars at the left and right, consider doing
the crop in transcode rather than having the AV500 zoom the image to
remove the black bars. Why? Well, if you scale up the image on the
AV500, it will tend to exacerbate any defects in the encoding -- you'll
never get better quality by making pixels stretch further. But
if you crop the image in transcode and end up with something that exactly
fits the AV500 screen the way you like it, the unit won't have to scale
anything. Of course, this is not a sensible thing to do if you plan to
watch on other screens -- you're throwing away part of the source material.
File size considerations The settings I describe above will
generate AVI files whose size is about 260 Mb for each hour of programme.
At a bitrate of 500 kbits/sec (-w 500), and two-pass
encoding, you're effectively watching a DVD on a small screen. You'll see
some encoding artefacts if you put your face up to the screen, but for normal
viewing the quality is as good as it needs to be, in my opinion.
However, if minimizing file size is your goal, you'll find that with the
divx codec, and two-pass encoding, you can turn the bitrate
down to about 200 kbits/sec, and still end up with something watchable.
You wouldn't want to put your face up to the screen, and you certainly
wouldn't want to play it on a large screen, but for watching on the
train, for example, it should be fine. At this bitrate setting, your
file sizes will be about 160 Mb/hour.
©1994-2006 Kevin Boone, all rights reserved