Ключевые слова:dvd, cdrom, freebsd, (найти похожие документы)
Date: Tue, 15 Jun 2004 14:30:08 +0600
From: Vladimir Kurtukov <Vladimir_Kurtukov@f9.n5006.z2.fidonet.org.>
Newsgroups: ftn.ru.unix.bsd
Subject: Запись DVD-R под Unix
DS> Вообще, судя по ману, не вместо, а именно после. -dvd-compat -
DS> это ключ самого growisofs, а -dvd-video он передаёт mkisofs.
-dvd-video growisofs и сам понимает, включая автоматом -dvd-compat.
в man-е это не описано, описано в faq
DS> Осталось решить последнюю проблему - двуслойки->однослойки...
может кому пригодится...
-+- cut here ---
Hеобходимые программы:
1. dvdauthor, dvdunauthor
/usr/ports/multimedia/dvdauthor
2. mplex
mjpegtools не ниже 1.6.2
в портах на данный момент версия не та ;-(
3. extract_mpeg2
/usr/ports/multimedia/libmpeg2
4. extract_a52
/usr/ports/multimedia/liba52
5. tcprobe
/usr/ports/multimedia/transcode
6. M2VRequantizer
http://metakine.com/files/M2VRequantiser.tgz
7. growisofs, mkisofs
/usr/ports/sysutils/dvd+rw-tools
/usr/ports/sysutils/mkisofs
Сам процесс:
1. dvdunauthor-ом делаем с dvd проект. он его делает не совсем
правильно и надо либо выкинуть vmgm и menus секции, либо как-то
дописать недостающее. для компьютерных dvd можно выкинуть.
2. надо посмотреть, что собой представляет vob
# tcprobe -i vob_01_001t.vob
[tcprobe] MPEG program stream (PS)
[tcprobe] summary for vob_01_001t.vob, (*) = not default, 0 = not detected
import frame size: -g 720x576 [720x576]
aspect ratio: 16:9 (*)
frame rate: -f 25.000 [25.000] frc=3
PTS=0.2873, frame_time=40 ms, bitrate=9800 kbps
audio track: -a 1 [0] -e 48000,16,2 [48000,16,2] -n 0x2000 [0x2000]
PTS=0.2873, bitrate=384 kbps
detected (2) subtitle(s)
3. затем большой vob расчленяем на video и audio потоки
extract_mpeg2 <vob_01_001t.vob >vob_01_001t.m2v
extract_a52 -s 1 <vob_01_001t.vob >vob_01_001t.ac3
в ключик -s подставить номер нужной дорожки, см. -a в выводе tcprobe
проверить, какая же именно дорожка нам нужна, можно задав
mplayer-у ключик -aid 128+<номер нужной дорожки>
4. берем софтину M2VRequantizer
# ls -l vob_01_001t.m2v
-rw-r--r-- 1 root wheel 1833868872 Mar 5 22:58 vob_01_001t.m2v
# ./M2VReqiantizer 1.2 3 1833868872 <vob_01_001t.m2v >vob_01_001t-out.m2v
M2VRequantiser by Makira.
Using 1.200000 as factor, 1833868872 as m2v size.
factor - число, во сколько раз будет уменьшен размер файла
# ls -l vob_01_001t-out.m2v
-rw-r--r-- 1 root wheel 1525283645 Mar 5 23:36 vob_01_001t-out.m2v
5. собираем обратно vob
# mplex -f 8 -o vob_01_001t.vob vob_01_001t-out.m2v vob_01_001t.ac3
где -f 8 - формат DVD
6. остается запустить dvdauthor
# dvdauthor -o dvd -x dvdauthor.xml
# dvdauthor -T -o dvd
и в каталоге dvd будет результат
7. запись на болванку
# growisofs -Z /dev/cd0c -speed=4 -dvd-video -V LABEL dvd
где /dev/cd0c - эмуляция SCSI на ATAPI драйве (device atapicam)
-+- cut here ---
этот вариант действий не единственный и не самый оптимальный,
просто именно так оно у меня заработало. выдержки из буржуйских
экспериментов:
=== Cut ===
I'm doing backups to some DVDs of mine, using something like this:
#############################################
proj=some-funky-name
mkfifo vid.fifo
mkfifo aud.fifo
tcdemux -i vid.fifo -x vob -d 0 | \
tcextract -t vob -x mpeg2 -d 0 | \
tcextract -t raw -x mpeg2 -d 0 > ${proj}.m2v &
tcdemux -i aud.fifo -x ac3 -a ${aud} -d 0 | \
tcextract -t vob -x ac3 -a ${aud} -d 0 | \
tcextract -t raw -x ac3 -d 0 > ${proj}.ac3 &
tccat -T ${n},-1 -i ${dev} -t dvd -d 0 | \
tee vid.fifo aud.fifo > /dev/null
rm -f vid.fifo
rm -f aud.fifo
for ch in .cprobe -T ${n} -H 10 -i /dev/dvd 2>&1 | \
grep Chapter | \
cut -d ] -f 2 | \
cut -c 2-; do
echo -n ${ch} >> chap-temp.txt
echo -n "," >> chap-temp.txt
done
i=.c -m chap-temp.txt | cut -f 1 -d c
i=$[ $i - 1 ]
cat chap-temp.txt | cut -c 1-${i} > chapters.txt
rm -f chap-temp.txt
# (optional step, if .m2v is too big)
# (just set $q at the right value)
# mv ${proj}.m2v ${proj}-big.m2v
# cat ${proj}-big.m2v | requant ${q} > ${proj}.m2v
# (requant is part of M2VRequantizer)
mplex -f 8 -S 4400 ${proj}.m2v ${proj}.ac3 -o ${proj}.vob
dvdauthor -o ${proj} -c .at chapters.txt ${proj}.vob
dvdauthor -T -o ${proj}
growisofs -speed=${sp} -Z /dev/scd0 -V ${proj} \
-dvd-video ${proj}
###############################################
Everything is fine, except two issues:
1. Independent of transcode version, the chapters in the final DVD are
not exactly at the same timings as in the original DVD.
The first 4...7 chapters usually are, but then it's like chapter marks
on the backup DVD are set too early, often catching the endings of the
previous chapters (as they were on the original). It's like the drift
increases towards the end of the backup, up to two seconds or so.
2. This seems to occur with the current CVS version, it did not seem to
occur with latest stable transcode (but i could be wrong).
There's a fixed, large A/V de-sync in the resulting VOB after the mplex
step, which is carried over to the backup DVD. The sound comes too
early, about 0.6 - 1.2 seconds. To fix it, i need to copy the first
15...30 frames of the original AC3 file, and paste them again in front
of the AC3 file, essentially repeating the initial 0.6 - 1.2 seconds to
push the sound back and fix the de-sync.
It does not happen, though, with all DVDs, and i'm not even sure if it's
the current CVS which has the issue, or just the DVDs that i backed up
recently. I cannot try with latest stable transcode again, don't have
time for that, i apologize.
Anyway, even with latest stable transcode, i noticed such a drift if i
don't dump A and V directly from DVD, but instead dump the title with
dvd::rip and then extract the A and V.
If you think i'm mistaken, then i probably am. :-) I just want to let
you know, in case something rings a bell somewhere.
--
Florin Andrei
http://florin.myip.org/
=== Cut ===
=== Cut ===
###Begin script###
#!/bin/sh
tccat -i /dev/dvd -T 1,-1 -L >catted.vob
tcextract -i catted.vob -t vob -x mpeg2 > ofile.m2v &&
tcextract -i catted.vob -t vob -x ac3 -a 0 > ofile.ac3 &&
tcprobe -i /dev/dvd -T 1 -H 10 2>&1 | egrep "\[Chapter ..\] " | \
cut -d " " -f 4 | perl -pi -e 's/\n/,/' | \
perl -pi -e 's/,$//' >chap.list &&
#tcrequant -i ofile.m2v -o movie.m2v -f 1.41 &&
tcrequant -i ofile.m2v -o movie.m2v -f 1.13924050632911392405 &&
mplex -f 8 -S 0 -o movie.mpeg ofile.m2v ofile.ac3 &&
dvdauthor -t -a ac3+en -c .at chap.list -o dvd movie.mpeg &&
dvdauthor -T -o dvd &&
mkisofs -dvd-video -udf -o dvd.iso dvd &&
echo "Done."
###End script###
Okay, this looks like exactly what I need :) One question, do you
multiply the audio file size by 2 because you are including 2 audio
streams? For example, with one video and one audio stream, I would do
the following:
requant_factor = (video_size / (dvdmax_size - audio_size)) * 1.04;
The folks who wrote tcrequant deserve a beer :^> That's just downright
straightforward.
No need to send the Java program. I'm in the process of writing a Perl
script to do this. Hopefully I'll have time to add Tk to it.
Thanks for the solution!
Cooper.
=== Cut ===