Sunday, January 25, 2004

 

Closed Captioning Guidelines

Here's a PDF file about how closed captions should be written.

Wednesday, January 21, 2004

 

Correcting Subtitle Colors

The quest to get the subtitle colors correct continues. Xine shows different colors when viewing the VOB file than playing the DVD. Ogle shows the same colors (black/black) regardless except it won't play when no audio device is available. This was fixed by adding this to ~/.oglerc

<ogle_conf>
<audio>
<device>
<driver>null</driver>
</device>
</audio>
</ogle_conf>


I read through the dvdauthor documentation and it says if the subtitles come from spumux, the color palette will be passed. If not, you can specify it as such in your project.xml file:
<pgc palette="subtitle.rgb">

<vob file="project-sub.mpeg" />
</pgc>


Here is the subtitle.rgb file with values that match the defaults set in xste's global subtitle palette.
000000

EBEBEB
101010
FFFFFF
FF0000
00FF00
0000FF
FFFF00
FF00FF
00FFFF
EB8A00
20D9FF
51A92D
FDBD00
FFF5AD
7D7D81


That did the trick!

 

XSTE Fixes and Subtitle Colors

I got a nice email back from Jan Panteltje, the author of xste. He's adding in more error messages and the frame rate fix into his next release, so hopefully fewer people will be hitting themselves in the head ;-).

He also answered a question I had regarding the colors of the subtitles. I was getting different colors than what I had specified in xste. This isn't related to xste, but the player. He's had success with Ogle and standalone players, but color problems with Xine and MPlayer. Specifically, he said MPlayer uses it's own colors. I'm getting all-black subtitles in Xine and Ogle, but white with grey outlines in MPlayer.

I tried to test out the DVD in my standalone player, a Pioneer DV-414 (more than three years old). The first disk I burned on DVD+RW played on this machine, to my surprise, but this one doesn't. The difference is this movie has subtitles (probably not it) and this movie is made up of three parts. Neither had a menu. Also, the second movie was rewritten over the same disk. I'll try reburning a single title DVD and burning to a fresh DVD+RW.

The reburned single-title DVD played, but the picture was broken up badly--the DV-414 was struggling to read it. Maybe I got lucky getting it to read the first DVD+RW. On the hypothesis that a re-burned DVD is harder to read for an older player (just a guess, really), I burned a freshly formatted DVD+RW. This played fine. After a few more tests, I'm of the opinion that reburning a disk makes it harder for my older player to read it. It doesn't have anything to do with presence of subtitles, multiple titles or anything like that. The first burn plays fine, but subsequent burns either don't play at all or have that nasty, broken-up, highly pixelated video.

As for the subtitles, my Pioneer is showing them all-black, just like Xine and Ogle. This leads me to believe Xine, Ogle and my standalone player are fine and MPlayer is doing its own thing. Oh, to play from the DVD:

xine -u 0
If the control window doesn't show up, right click in the video window and select GUI visibility. Then click DVD in the control window.

ogle /dev/dvd
Turn on subtitles on the control window. It's the icon second from the right on the bottom row (just left of the movie camera icon).

mplayer -sid 0 /dev/dvd
Nice, except you can't rely on the colors it displays.


Monday, January 19, 2004

 
I found a better way to create the MPV file:

extract_mpeg2 project.mpeg > project.mpv

Then copy project.mpv to /video/vie/project/.

I was still getting the "frames per second" error. This turned out to be an error in the source code in xste-3.2.5/video.c line 161:

if ( video_file_fps != dframes_per_second )

will fail due to approximate representations of floating pointnumbers. I changed the code to:

if ( fabs(video_file_fps - dframes_per_second) >= 0.001 )


That fixed the error message, but I still didn't have preview video. Then I got this error on stdout: xste: preview_display(): video size 720 x 480 not equal selected display size 720 x 576. After screwing around with mpeg utilities to convert my video to 720x576, I hit myself in the head and changed vert size to 480 on the xste main screen. I clicked on another subtitle line and the video was there! I tried different lines and it updated the subtitles but not the video. That's when I noticed this error on stdout:
mpeg3video_seek: frame accurate seeking without a table of contents is no longer supported. Use mpeg3toc <mpeg file> <table of contents> to generate a table of contents and load the table of contents instead.

So in /video/vie/project:

mpeg3toc project.mpv project-toc.mpv

and load project-toc.mpv when the preview video button asks for the mpv file.

Now to add subtitles to my video. The Output button on the xste main window creates ~/.subtitles/project/project.sub.

From the ~/.subtitles/project directory:

submux-dvd -P /mnt/edit/project/project.mpeg project.sub /mnt/edit/project/project-sub.mpeg
You have to do this from the directory where you ran xste because the paths to the bmp files are stored in project.sub as relative, not absolute.

From /mnt/edit/project, edit your DVD XML file and change the name of the MPEG file to the new MPEG+Subtitles file you just created. Then create your DVD files:

rm -rf dvd; dvdauthor -o dvd -x project.xml

Play the new dvd directory with

Ogle: ogle dvd/VIDEO_TS

or MPlayer: mplayer -sid 0 dvd/VIDEO_TS/VTS_01_1.VOB

or Xine: xine -u 0 dvd/VIDEO_TS/VTS_01_1.VOB

Sunday, January 18, 2004

 

XSTE Preview

The mpv file I swiped from Kino export whilst it was in the middle of working (it deletes it after mplex) caused this error from xste: Frames per second error in /video/.vie/project/project.mpv
29.970 is different from 29.970 specified in main form
this will give timing errors


WTF?

Tried SMILutils. This is a tar xf; configure; make; make install type installation. The magic incantation this time is smil2yuv kino.smil -a project.mp2 | yuvscaler -O VCD | mpeg2enc -o project.mpv -f 1. Same error from xste unfortunately.

 

Resizing a Linux ext3 Partition

The DVD editing partition is mounted at /mnt/edit. It's an ext3 file system. To back it up, I put in a DVD+RW, changed to /mnt and ran growisofs -M /dev/dvd -R -J edit. About 20 minutes later, the 3.7GB was backed up.

Parted is supposed to be able to resize an ext3 file system, but version 1.6.3 complains No Implementation: This ext2 filesystem has a rather strange layout! Parted can't resize this (yet). This is strange because print shows the system to be ext3. Mm-kay. I remember reading that it's easy to switch between ext2 and ext3 and found the following commands to do so:

ext3 -> ext2: tune2fs -O '^has_journal' /dev/hdb2

ext2 -> ext3: tune2fs -j /dev/hdb2

Alas, parted still complained about the partition in its ext2 incarnation. Some Googling turned up references to this error as an unresolved Parted issue due to Parted using an old version of ext2resize. The recommendation is to use the utility directly. So I downloaded and installed (rpm -Uvh) ext2resize-1.1.17-1.i386.rpm from the ext2resize site. The man page for ext2resize says it only resizes the file system, not the partion. To resize the partion, you should delete and recreate it with fdisk making sure you use the same starting position. Hey, I made a backup, right? On exit of fdisk, it said there was a problem reloading the partition table and the kernel would use the old one. Time for a reboot.

So far, so good. Next command is ext2resize /dev/hdb2 which will resize the file system to fill the partition (now about 104GB). No errors. Converted back to ext3 and mounted. Touchdown!

 

SCSI Emulation of IDE DVD Drive

Before getting too far into the DVD creation project, I thought I'd increase the size of my editing partion. Yes, these are the things I think when I wake up at 6 am. It's 40GB, but since it's a quarter full already and I've got lots more video to work with, I want to avoid the hassle later. The first step is backing up what's there. Why not use the DVD drive? I poped in a DVD+RW and clicked on the DVD icon on my desktop. Instead of the directory listing in Konqueror, a message box came up telling me
Could not mount device.
The reported error was:
mount: wrong fs type, bad option, bad superblock on /dev/dvd, or too many mounted file systems
(could this be the IDE device where you in fact use ide-scsi so that sr0 or sda or so is needed?)


Pretty nice error message, huh? I had set up IDE-SCSI emulation earlier for the DVD burning tools, but I didn't update my entries in /etc/fstab nor my links in /dev. /dev/dvd was pointing to /dev/cdrom which was pointing to /dev/hdc and there was no entry for the DVD in /etc/fstab. So I added /dev/dvd /mnt/dvd udf,iso9660 user,noauto,kudzu,ro 0 0 to /etc/fstab and made /dev/dvd point to /dev/scd0. Now I got "no medium" when I put a disk in. cat /proc/scsi/scsi told me the Plextor PX-708A was on scsi host scsi1, channel 0, id 0, lun 0 but not which device in /dev it was attached to. This ought to be in /var/log/messages (dmesg) but thanks to long uptimes and having a million Windows machines bombarding my firewill, the startup messages scrolled out of /var/log/messages*. After scratching my head awhile and contemplating a reboot to see the startup log, I remembered scd0 is the first SCSI CD device--my older Plextor PX-W1210S, which is actually a SCSI unit. After changing /dev/dvd to point to /dev/scd1, it mounted. I need some coffee.

Saturday, January 17, 2004

 

Using XSTE

I went into Kino and exported sound from one of my movies (Export/Audio). The default sample rate was 32KHz, so I changed it per the xste documentation to 44.1KHz. xste requires the name of this file to be sound.wav and it must be in ~/.subtitles/project/sound.wav. Also, click the green button that says AUDIO RAW so that it turns yellow and says AUDIO WAV.

Hitting the AUTO button causes xste to generate a list of frame numbers corresponding to when speaking occurs. This sorta works. Then you chose the number from the list and listen to what's there and transcribe it. There's a subtitle preview, but I need to get a .mpv file out of Kino for this. SMILUtils will do it, but the site is down now. I'll try tomorrow.

 

Building XSTE

I've installed submux-dvd and xste. xste required xforms and libmpeg3 . Note xforms is supposed to be available from Savannah, but it isn't there now. The link I have here I found from Googling. It seems just fine.

These are all source packages, which I put in /usr/local/src. Everything compiled without a hitch except xste. It seems the make install of libmpeg doesn't install libmpeg3.a in /usr/local/lib and xste didn't know where to find the xforms header files, so in xste-3.2.5/Imakefile, I had the make the following additions:

EXTRA_LIBS = -lpthread -lfreetype -L/usr/local/src/libmpeg3-1.5.3/i686

EXTRA_INCLUDES = $(FREETYPE2INCLUDES) -I/usr/X11R6/include/X11 -I/usr/local/src

and add a softlink in /usr/local/src so that libmpeg3 points to libmpeg3-1.5.3. Make these changes before you do any compiling. If you didn't, you'll have to start over at the xmkmf step. Not a big deal really.

Thursday, January 15, 2004

 

Transcoding

I just finished the latest issue of Linux Journal. The article on DVD authoring caught my eye, of course. It covers territory similar to what I've been doing, but nothing new. I was hoping they'd mention a project to automate adding either captions or subtitles, but no luck. BTW, I've yet to evaluate submux-dvd and xste, two tools that might help with this. More on this soon.

Also in this issue, there was an article on transcoding, which was something I'd heard of, but was unfamiliar with. It's the process of transferring a video in one format to another. For example, converting the MPEG-2 format found on DVDs to MPEG-4, which can compress the stream enough to fit on CD-R disks, which are more easily produced and at less cost. Interesting, but not where I'm going.

Wednesday, January 14, 2004

 

Subtitle Editing

Found a subtitle editor called xste. It doesn't use spumux, but another program available on the same site called submux-dvd.

Saturday, January 10, 2004

 

Subtitles

From what I read a few weeks ago, there isn't any open source tool for captioning, however dvdauthor comes with a tool called spumux that can merge subtitles into an mpeg stream. It looks like a lot of manual work, so since I'm a lazy programmer, I expect I'll write something to make this more automated.

 
There's another captioning company called VITAC, but after the horrible job they did with the first episode of "The Apprentice", I wouldn't trust the tools they're using. The captions at the start of the show were the words to the background music and covered the names of the contestants. All during the show, the captions were 5-10 seconds behind the spoken words. I got a headache trying to keep them together.

Thursday, January 08, 2004

 

Closed Captioning

In addition to making DVDs, I want to add closed captions. Hearing loss runs in my family and it'd be a shame if the girls' great grandmother couldn't hear their pearls of wisdom.

To start, two sources of information about captions commonly seen on TV are The National Captioning Institute and WGBH, Boston (public television).

Saturday, January 03, 2004

 

References


 

Burning a DVD

The output from Kino isn't suitable for burning a DVD. It's one giant mpeg file (in this case dvd.mpeg). In order to create the directory structure DVD's use, you need dvdauthor. This program uses an XML file as input. The simplest is a DVD with one chapter on it that just plays when you put it in a DVD player. Here is dvd.xml:
<dvdauthor>

<vmgm />
<titleset>
<titles>
<pgc>
<vob file="dvd.mpeg" />
</pgc>
</titles>
</titleset>
</dvdauthor>

Then you run dvdauthor: dvdauthor -o dvd_dir -x dvd.xml which creates a directory called dvd_dir. Then you need to run mkisofs -dvd-video -udf -o dvd.iso dvd_dir/ to create the file that will be used to burn the DVD.

The Plextor DVD burner is an IDE unit, so SCSI emulation must be set up for it. For me, that meant adding the following lines to /etc/modules.conf:
# 27dec2003:  SCSI emulation for Plextor PX-708A DVD burner on /dev/hdc

options ide-cd ignore=hdc # tell the ide-cd module to ignore hdc so scsi can have it
alias scd1 sr_mod # load sr_mod upon access of scd1 (scd0 is CD burner)
pre-install sg modprobe ide-scsi # load ide-scsi before sg
pre-install sr_mod modprobe ide-scsi # load ide-scsi before sr_mod
pre-install ide-scsi modprobe ide-cd # load ide-cd before ide-scsi


Burning a DVD threw me for a loop. The Plextor burner supports DVD+RW and DVD-RW. I bought +RW disks when I ordered it. Initially I wanted to use RW disks for testing, so if I messed them up, I wouldn't create a coaster. Once I made a good disk, I'd use the DVD+R disks, as these are more likely to play in a standard DVD player. The problem is, dvdrecord doesn't work with plus media, only dash media, so I got this funny error:
Last chance to quit, starting real write in 0 seconds. Operation starts.

trackno=0
dvdrecord: Input/output error. reserve track: scsi sendcmd: no error
CDB: 53 00 00 00 00 00 05 2C 30 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 20 00 00 00
Sense Key: 0x5 Illegal Request, Segment 0
Sense Code: 0x20 Qual 0x00 (invalid command operation code) Fru 0x0
Sense flags: Blk 0 (not valid)
cmd finished after 0.000s timeout 200s
dvdrecord: Cannot open new session.

Using the tools from DVD+RW/+R/-R[W] for Linux fixed that problem. There's a nice tutorial at the bottom of that page that explained everything. I used these commands:
dvd+rw-mediainfo /dev/dvdrw

dvd+rw-format /dev/dvdrw
growisofs -Z /dev/dvdrw=dvd.iso
then ogle /dev/dvdrw to play the new disc.

One thing that still needs to be fixed is that the raw1394 module doesn't get loaded automatically when Kino is started, so for now I have to check first with /sbin/lsmod | grep 1394 and modprobe raw1394 if it's not there.

 

Creating a DVD Jewel Case Insert

To create the insert for the DVD case, I used cdlabelgen. This makes labels for CD jewel cases and a newer version will make inserts for the larger DVD cases if you use those instead. To make a label, grab a still from the video first. In Kino, use the Export tab on the right and select the Stills tab. Select Current as the export range (or by default, you'll get one picture per frame). Enter in something like dvd-cover.png as the file name and select Export. Convert the image to encapsulated postscript with convert dvd-cover.png dvd-cover.eps. Convert is part of ImageMagick. Then enter cdlabelgen -e dvd-cover.eps -S 0.0 -m -o dvd-label.ps. Then lp dvd-label.ps to print.

 

Capturing Video from the Camcorder

One thing you'll definitely need is lots of disk space. That's where QTParted comes in. It is the Linux equivalent of Partition Magic. It lets you create and resize partions non-destructively.

As a rule of thumb, you'll need 5GB per 15 minutes of video if you keep all the artifacts. In my case, the first video was a little more than 14 minutes long. The 16 AVI capture files totaled 2.9G. The converted DVD format file created by Kino was 663 MB. From this the DVD directory structure and control files were created (also 663MB) and an ISO file of the same size with the DVD file system was created and used to burn the disk. All these and miscellaneous other files took 4.8GB. You can get by with less if you delete the files from the prior step as you complete the next one.

To transfer video from the camcorder into the computer USB 2.0 or Firewire are OK, but USB 1.x is too slow. I set up my Firewire card using the instructions from Linux1394.

Note the current kernel for Red Hat 9 is 2.4.20-27.9, so no patches need to be applied. The stock kernel also has all the required modules, so no kernel configuration was necessary.

Once dvgrab was working, Kino worked also. In Kino, select the Capture tab on the right, enter a file name and path you want to give the video (it'll split the video into multiple files named, e.g., capture001.avi, capture002.avi and so on) and select the Capture button.

Once video is captured, choose the Export tab on the right, and the MPEG tab on top (you'll have to scroll the tabs to the right). Change file format to DVD and enter a file name to export to. Select Export and w-a-i-t. On my machine, it takes about an hour per 15 minutes of video.

 

Digitizing VHS Tapes

Nothing fancy here. I just hooked up the camcorder to the line-out RCA jacks on my VCR and recorded the home movies I had on VHS tapes. Although the tapes are still perfectly fine for playing, I wanted to
digitize them for long-term storage. VHS will break down eventually and although archiving tape to tape will avoid that problem, there is some signal loss each time the tape is copied. The wonderful world of
bits and bytes allows copies to be made with no signal degradation.

 

Software


 

Hardware

This is the list of relevant hardware. The video and audio cards are at least as old and cheap as anything you'll find, so you don't need high-powered stuff there.

Computer:


Camcorder:

 

Introduction

This is a log of how I made DVDs of my home movies. Some were shot directly with my mini-DV camcorder and others were transfered from VHS tape.

Keep in mind this isn't a scientific explanation of how to do this. This is how I did it, warts and all. I'm not an expert at this (yet). Your mileage may vary. And if you notice anything that I've got wrong, please email me at <dagdvd at emailias dot com> and I'll fix it.

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]

BlogPhiles webring:  Previous Site | Random Site | Next | Membership Guide | Site List