Using a cache with a DVD
Usually encode2mpeg needs to read several times the source video:
- multipass video access
- multiaudio audio access
- chapters reading
- subtitles reading
If the source video is on a DVD disk, encode2mpeg requires a
significative amount of
time just for disk access.
For example a transfer of a DVD to a DVD with chapters, video copy, 2
audio channels copy and 1 subtitles like:
encode2mpeg -o NOCACHE -dvd dvd://1 -mpeg -encode 0:0:1 -multiaudio 128,129 -addchapter copy -addsub 0 -imageonly
requires about 1h56m.
The same transfer with cache support:
encode2mpeg -o ADDCACHE -dvd dvd://1 -mpeg -encode 0:0:1 -multiaudio 128,129 -addchapter copy -addsub 0 -imageonly -cachedvd /var/tmp/cache /media/cdrecorder
takes instead 1h23m. There is a 25% time reduction. The time gain is
not always the same, it depends of the options. Under certain
conditions, you could increase the time required instead of reducing it.
However the BIG advantage is
in successive transfers. Once the DVD is
cached, a new transfer will proceed as fast as possible:
encode2mpeg -o USECACHE -dvd dvd://1 -mpeg -encode 0:0:1 -multiaudio 128,129 -addchapter copy -addsub 0 -imageonly -dvd-device /var/tmp/cache/<TITLE>
takes now 0h51m. The time reduction now is 55%. Again, with certain
options, the time gain could be irrelevant.
Cache options
To cache a DVD on the hard disk add:
-cachedvd <cache dir> <dvd mount point>
Once you have cached the dvd on the disk, you can use the cache content
for succesive run adding the option:
-dvd-device <cache dir>/<DVDTITLE>
You can save the content of the cache to a DVD disk with:
-savecache
or,
if you want to create only an iso image, use:
-savecache iso
In order to remove the cache content from the disk at the end of a run,
add,
together with -cache or -dvd-device, the option:
-removecache
If you want to execute only cache operations (create/save/remove cache)
add:
-cacheonly
Example
encode2mpeg -o DISK -cachedvd /var/tmp/cache /media/cdrecorder -savecache -removecache -cacheonly
will do only a verbatim copy of a DVD
Raid DVD
Most DVD movies are on a DVD9, their size is bigger than 4.38GB so
they will not fit on a single layer DVD. It it possible however to
store a DVD9
on two single layer DVD and watch (on a pc) the movie as if it was
stored on a single disk.
Add to encode2mpeg the option:
-savecache raid
or,
if you want to create only the iso images, use:
-savecache raid iso
When using -savecache raid, encode2mpeg needs root access in order to
use loosetup and mdadm and will ask for the root
password.
Once you have the two DVD, or the two iso images, you need to mount
them. Together with encode2mpeg you will find the script mountdvdraid that is able to mount
two disks together:
mountdvdraid /media/dvd /dev/sr0 /dev/sr1
will execute something like:
- losetup /dev/sr0 /dev/loop0
losetup /dev/sr1 /dev/loop1
mdadm -B /dev/md0 -l linear -n 2 /dev/loop0 /dev/loop1
mount -o ro /dev/md0 /media/dvd
and
mountdvdraid /media/dvd
will do the reverse operation.
After the mount operation, the full content of the original DVD is
available in /media/dvd and you can watch it with your favorite player.
For practical reasons, you need to have two dvd drives in your pc, but
also with only one drive you can mount the two disks. Just dump one dvd
on the hard disk (dd if=/dev/dvd
of=image) and later mount the disk
image and the second dvd (mountdvdraid
/media/dvd image /dev/dvd).
IMPORTANT:
- mountdvdraid requires root privileges and it will ask you the
root
password.
- The order of the two disk images is important: if you swap the
first
and the second image, mounting will not work.
- encode2mpeg assumes that the raid devices mdn and the loop devices loopn are in /dev. If your system put
them in some subdirectories or uses different names for them, please
let me know and I will fix the program
- You need mdadm installed. If your distribution does not provide
it,
look at http://www.cse.unsw.edu.au/~neilb/source/mdadm/
- You could be able to watch the first disk on a standalone DVD
player,
but at same point the player will stop because it will not find part of
the movie. The second disk does not work at all on a standalone DVD
player.
Top