2004-05-07

VCD to DVD-VCD under Linux

Encode VCD audio to 48000Hz
$ mpgsplit movie.mpg [0-50M] -o vcd.mpg

$ du -hs vcd.mpg
489M    vcd.mpg
$ mpginfo vcd.mpg48k
vcd.mpg
  Mpeg 1 System File [Video/Audio]
  Muxrate : 1.41 Mbps
  Estimated Duration: 48:57.47s
  Size [352 x 240]     29.97 fps    1.15 Mbps
  Audio : Mpeg 1 layer 2
  224 kbps  44100 Hz
  Stereo,  No emphasis
(A) Approach 1: Reencode -> demux -> mplex
$ mencoder \
-ovc copy \
-oac lavc lavcopts acodec=mp2:abitrate=224 -srate 48000 -idx -noskip -sws 2 \
-of mpeg vcd.mpg -o outfile.mpg48k > /dev/null
real    4m25.739s
user    2m34.639s
sys     0m18.953s
$ mpginfo outfile.mpg48k
outfile.mpg48k
  Mpeg 1 System File [Video/Audio]
  Muxrate : 2.11 Mbps
  Estimated Duration: 48:57.08s
  Size [352 x 240]     29.97 fps    1.15 Mbps
  Audio : Mpeg 1 layer 2
  224 kbps  48000 Hz
  Stereo,  No emphasis
$ mpgdemux outfile.mpg48k
real    1m23.077s
user    0m2.966s
sys     0m4.411s
$ mplex -f 8 -o outfile.vobmpg chunk-0.m1v chunk-0.mp2
real    2m2.510s
user    0m43.697s
sys     0m7.602s
(B) Approach 2: Demux -> toolame Audio -> mplex
Verify the vobmpg
$ dvdauthor -o dvd_test outfile.vobmpg
$ rm -rf dvd_test
DVD Authoring
$ dvdauthor -x dvdvcd.xml
DVDAuthor::dvdauthor, version 0.6.9.
Build options: gnugetopt magick iconv freetype
Send bugs to 

INFO: Locale=LC_CTYPE=zh_TW.Big5;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY
INFO: Converting filenames to BIG5
INFO: dvdauthor creating VTS
STAT: Picking VTS 01

STAT: Processing Part1.vobmpg...
STAT: VOBU 4848 at 499MB, 1 PGCS
INFO: Video pts = 0.178 .. 2937.579
INFO: Audio[8] pts = 0.178 .. 2937.658

STAT: Processing Part2.vobmpg...
STAT: VOBU 9866 at 1011MB, 1 PGCS
INFO: Video pts = 0.178 .. 3011.452
INFO: Audio[8] pts = 0.178 .. 3011.530
STAT: VOBU 9876 at 1013MB, 1 PGCS
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg1
INFO: TV standard: ntsc
INFO: Aspect ratio: 4:3
INFO: Resolution: 352x240
INFO: Audio ch 0 format: mp2/2ch, 20bps

WARN: Audio channel 1 gap is negative (-7098) on VOB Silver1.vobmpg cell 1
STAT: fixed 9876 VOBUS                        
INFO: dvdauthor creating VTS
STAT: Picking VTS 02

STAT: Processing Part3.vobmpg...
STAT: VOBU 6496 at 656MB, 1 PGCS
INFO: Video pts = 0.178 .. 3866.073
INFO: Audio[8] pts = 0.178 .. 3866.146

STAT: Processing Part4.vobmpg...
STAT: VOBU 12254 at 1238MB, 1 PGCS
INFO: Video pts = 0.178 .. 3419.193
INFO: Audio[8] pts = 0.178 .. 3419.290
STAT: VOBU 12264 at 1240MB, 1 PGCS
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg1
INFO: TV standard: ntsc
INFO: Aspect ratio: 4:3
INFO: Resolution: 352x240
INFO: Audio ch 0 format: mp2/2ch, 20bps

WARN: Audio channel 1 gap is negative (-6537) on VOB KooYin1.vobmpg cell 1
WARN: Audio channel 1 gap is negative (-6537) on VOB KooYin2.vobmpg cell 1
STAT: fixed 12264 VOBUS                        
INFO: dvdauthor creating VTS
STAT: Picking VTS 03

STAT: Processing Part5.vobmpg...
STAT: VOBU 6880 at 629MB, 1 PGCS
INFO: Video pts = 0.178 .. 3685.526
INFO: Audio[8] pts = 0.178 .. 3685.594

STAT: Processing Part6.vobmpg...
STAT: VOBU 12765 at 1168MB, 1 PGCS
INFO: Video pts = 0.178 .. 3145.586
INFO: Audio[8] pts = 0.178 .. 3145.618
STAT: VOBU 12778 at 1169MB, 1 PGCS
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg1
INFO: TV standard: ntsc
INFO: Aspect ratio: 4:3
INFO: Resolution: 352x240
INFO: Audio ch 0 format: mp2/2ch, 20bps

WARN: Audio channel 1 gap is negative (-6090) on VOB paycheck1.vobmpg cell 1
WARN: Audio channel 1 gap is negative (-6090) on VOB paycheck2.vobmpg cell 1
STAT: fixed 12778 VOBUS                        
INFO: dvdauthor creating VTS
STAT: Picking VTS 04

STAT: Processing Part7.vobmpg...
STAT: VOBU 7456 at 572MB, 1 PGCS
INFO: Video pts = 0.184 .. 3354.864
INFO: Audio[8] pts = 0.264 .. 3355.032

STAT: Processing Part8.vobmpg...
STAT: VOBU 12109 at 928MB, 1 PGCS
INFO: Video pts = 0.184 .. 2076.504
INFO: Audio[8] pts = 0.264 .. 2076.672
STAT: VOBU 12110 at 928MB, 1 PGCS
WARN: GOP is not closed on cell 1 of source Itchy1.vobmpg of pgc 1
WARN: GOP is not closed on cell 1 of source Itchy2.vobmpg of pgc 1
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg1
INFO: TV standard: pal
INFO: Aspect ratio: 4:3
INFO: Resolution: 352x288
INFO: Audio ch 0 format: mp2/2ch, 20bps

WARN: Audio channel 1 gap is negative (-7920) on VOB Itchy1.vobmpg cell 1
WARN: Audio channel 1 gap is negative (-7920) on VOB Itchy2.vobmpg cell 1
STAT: fixed 12110 VOBUS                        
INFO: dvdauthor creating table of contents
INFO: Scanning DVD123/VIDEO_TS/VTS_01_0.IFO
INFO: Scanning DVD123/VIDEO_TS/VTS_02_0.IFO
INFO: Scanning DVD123/VIDEO_TS/VTS_03_0.IFO
INFO: Scanning DVD123/VIDEO_TS/VTS_04_0.IFO
INFO: Creating menu for TOC

STAT: Processing menu.mpg...

INFO: Video pts = 0.184 .. 2.184
INFO: Audio[8] pts = 0.184 .. 60.160
INFO: Audio[32] pts = 0.184 .. 0.184
STAT: VOBU 2 at 2MB, 1 PGCS
INFO: Generating VMGM with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: pal
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x576
INFO: Audio ch 0 format: mp2/2ch, 20bps

STAT: fixed 2 VOBUS
Play the DVD
$ xine dvd:/path/to/VIDEO_TS/
This is xine (X11 gui) - a free video player v0.9.23.
(c) 2000-2003 The xine Team.
libdvdnav: Using dvdnav version 1-rc4 from http://xine.sf.net
libdvdread: Using libdvdcss version 1.2.8 for DVD access
libdvdread: Couldn't find device name.
libdvdnav: Can't read name block. Probably not a DVD-ROM device.
libdvdnav: Unable to find map file '/home/brother/.dvdnav/.map'
libdvdnav: DVD disk reports itself with Region mask 0x00000000. Regions: 1 2 3 4 5 6 7 8
Burn the DVD
$ growisofs -dvd-compat -speed=4 -Z /dev/hdc -dvd-video -VR /path/above/VIDEO_TS
Executing 'mkisofs -vRJ . | builtin_dd of=/dev/hdc obs=32k seek=0'
mkisofs 2.01a27 (i686-pc-linux-gnu)
Scanning .
Scanning ./VIDEO_TS
Scanning ./AUDIO_TS
Writing:   Initial Padbock                         Start Block 0
Done with: Initial Padbock                         Block(s)    16
Writing:   Primary Volume Descriptor               Start Block 16
Done with: Primary Volume Descriptor               Block(s)    1
Writing:   Joliet Volume Descriptor                Start Block 17
Done with: Joliet Volume Descriptor                Block(s)    1
Writing:   End Volume Descriptor                   Start Block 18
Done with: End Volume Descriptor                   Block(s)    1
Writing:   Version block                           Start Block 19
Done with: Version block                           Block(s)    1
Writing:   Path table                              Start Block 20
Done with: Path table                              Block(s)    4
Writing:   Joliet path table                       Start Block 24
Done with: Joliet path table                       Block(s)    4
Writing:   Directory tree                          Start Block 28
Done with: Directory tree                          Block(s)    4
Writing:   Joliet directory tree                   Start Block 32
Done with: Joliet directory tree                   Block(s)    3
Writing:   Directory tree cleanup                  Start Block 35
Done with: Directory tree cleanup                  Block(s)    0
Writing:   Extension record                        Start Block 35
Done with: Extension record                        Block(s)    1
Writing:   The File(s)                             Start Block 36
/dev/hdc: "Current Write Speed" is 4.1x1385KBps.
  0.22% done, estimate finish Tue May  4 14:49:50 2004
 ...
 ...
 ...
  99.78% done, estimate finish Tue May  4 13:29:28 2004
Total translation table size: 0
Total rockridge attributes bytes: 2025
Total directory bytes: 6144
Path table size(bytes): 42
Done with: The File(s)                             Block(s)    2229675
Writing:   Ending Padblock                         Start Block 2229711
Done with: Ending Padblock                         Block(s)    150
Max brk space used 21000
2229861 extents written (4355 MB)
builtin_dd: 2229872*2KB out
/dev/hdc: flushing cache
/dev/hdc: closing track
/dev/hdc: closing disc

CD Recording

$ du -h
614M
$ cdrecord speed=40 -v dev=/dev/hdc file.iso
cdrecord: No write mode specified.
cdrecord: Asuming -tao mode.
cdrecord: Future versions of cdrecord may have different drive dependent defaults.
cdrecord: Continuing in 5 seconds...
Cdrecord-Clone 2.01a27 (i686-pc-linux-gnu) Copyright (C) 1995-2004 J顤g Schilling
TOC Type: 1 = CD-ROM
scsidev: '/dev/hdc'
devname: '/dev/hdc'
scsibus: -2 target: -2 lun: -2
Warning: Open by 'devname' is unintentional and not supported.
Linux sg driver version: 3.5.27
Using libscg version 'schily-0.8'.
SCSI buffer size: 64512
atapi: 1
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   :
Vendor_info    : 'LITE-ON '
Identifikation : 'DVDRW LDW-451S  '
Revision       : 'GSB6'
Device seems to be: Generic mmc2 DVD-ROM.
Current: 0x0009
Profile: 0x001B
Profile: 0x001A
Profile: 0x0014
Profile: 0x0013
Profile: 0x0011
Profile: 0x0010
Profile: 0x000A
Profile: 0x0009 (current)
Profile: 0x0008
Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).
Driver flags   : MMC-3 SWABAUDIO BURNFREE FORCESPEED
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Drive buf size : 1895168 = 1850 KB
FIFO size      : 4194304 = 4096 KB
Track 01: data   613 MB       
Total size:      704 MB (69:45.69) = 313927 sectors
Lout start:      704 MB (69:47/52) = 313927 sectors
Current Secsize: 2048
ATIP info from disk:
  Indicated writing power: 6
  Is not unrestricted
  Is not erasable
  Disk sub type: Medium Type B, high Beta category (B+) (5)
  ATIP start of lead in:  -11730 (97:25/45)
  ATIP start of lead out: 336350 (74:46/50)
Disk type:    Short strategy type (Phthalocyanine or similar)
Manuf. index: 62
Manufacturer: VIVASTAR AG
Blocks total: 336350 Blocks current: 336350 Blocks remaining: 22423
Forcespeed is OFF.
Starting to write CD/DVD at speed 40 in real TAO mode for single session.
Last chance to quit, starting real write    0 seconds. Operation starts.
Waiting for reader process to fill input buffer ... input buffer ready.
BURN-Free is ON.
Turning BURN-Free off
Performing OPC...
Starting new track at sector: 0
Track 01:  613 of  613 MB written (fifo 100%) [buf 100%]  39.8x.
Track 01: Total bytes read/written: 642918400/642918400 (313925 sectors).
Writing  time:  163.437s
Average write speed  28.0x.
Min drive buffer fill was 45%
Fixating...
Fixating time:   13.840s
cdrecord: fifo had 10127 puts and 10127 gets.
cdrecord: fifo was 21 times empty and 3221 times full, min fill was 0%.

real    3m11.734s
user    0m0.298s
sys     0m1.684s