Friday, December 14, 2007

Making an Anime OP/ED compilation DVD

A friend asked me to put together a DVD full of anime openings and endings a while ago. Sounds pretty easy, I thought; thus began my journey lasted over a week and took many hours of research with several failed attempts. I'll describe the eventual procedure I stumbled upon in this post.

First task was to find some anime openings and endings. I found most of my files from Tokyo Toshokan and Stage6; if you know of any other good sources let me know.

Conversion
Next, need to convert them into DVD-compliant mpeg2 files. After trying several programs, I finally settled on FAVC. Surprisingly, that was the only program I found that would work consistently with all the file types I had (mkv, avi, mp4). I ran into a bug with mkv handling on my version of FAVC; if you run into an error with mkv files, you need to install mkvtoolnix and copy a few DLLs to the FAVC directory (see my Doom9 post).

For FAVC, since I only used it to do the conversion, I skipped the iso creation and muxing steps. I used the HEnc encoder, though QuEnc would have worked fine too. I used AC3 audio @ 192kbps. Once the conversion is don, you'll find a folder in whatever destination directory you specified for FAVC.

Chapters and titles, oh my!
Now a bit of explanation on DVD titles and chapters. If you've ever watched a DVD, you'll notice that usually the main movie is on one title, and things like trailers and extra features on on separate titles. Most DVD creation programs make each video its own title, which makes sense for a lot of things. However, on the DVD players I tested, there is no easy way to skip between titles; on a DVD with many short videos, this could get annoying. So we need to basically combine all these videos into one title, which we can do with... Muxman!

Combining videos into one title
In the FAVC directory, there is a Muxman directory somewhere; this is usually used for creation of the files for a DVD. You basically load in all the video files output by FAVC (there should be m2v files in the output directory), load in all the audio files, then let it do it's thing. Then you can load the resulting VOBs into a DVD player on your computer (Media Player Classic if you don't have something like PowerDVD or WinDVD), and make sure the audio stays in sync throughout the entire file. If not, you'll have to figure out which video is causing the audio to go out of sync and use delaycut to fix the audio sync of that video. If you don't care about any fancy features, this should be it.

Fancy stuff: Motion menus and chapters
Now we convert the VOB to an mpg file using VOB2MPG. This is necessary because one of the programs we'll use later, dvdauthorGUI, only takes m2v/ac3 files. VOB2MPG is a pretty simple program, just load the VOB directory, and specify an output directory. Once you have the mpg file, load it in VirtualDub-MPEG2 and scroll through the file, writing the times for the chapter points in a text file in the format HH:MM:SS.ss.

Generating the menus
Next, use DGMPGDec to demux the mpeg file into m2v and ac3 files. Load these files into DVDAuthorGUI. After you load the files into DVDAuthorGUI, select "Create Motion Menu Script". This will create an AVISynth script; save it somewhere. You'll have to edit it a bit, here's an example of one I made (I removed the comments for brevity, but it was generated by dvdauthorgui:

header="Anime OP/ED WS"
nexttext="Next ->"
prevtext="<- Prev"
maintext="Normal"
bordercolor=$00ffff     #Edit this line to change the border color.
backgroundcolor=$333333 #Edit this line to change the background color.
textcolor=$ffffff       #Edit this line to change the text color
halocolor=$101010       #Border around the text
fontsize=18             #Font size
fontface="verdana"      #Font style
TitleText1="Bokurano OP"
TitleText2="Chobits OP"
TitleText3="Diebuster OP"
TitleText4="Dragonaut OP"
TitleText5="ef OP"
TitleText6="Haruhi OP"
TitleText7="Haruhi ED"
TitleText8="Haruhi Insert"

length=1200

title1=DirectShowSource("path to file").bilinearresize( 100, 66).addborders(2,2,2,2,bordercolor)
...

overlay(title1, 80, 125)
subtitle(TitleText1, 80, 195, font=fontface, size=fontsize, text_color=textcolor, halo_color=halocolor) 
overlay(title2, 230, 125)
subtitle(TitleText2, 230, 195, font=fontface, size=fontsize, text_color=textcolor, halo_color=halocolor) 
overlay(title3, 380, 125)
subtitle(TitleText3, 380, 195, font=fontface, size=fontsize, text_color=textcolor, halo_color=halocolor) 
overlay(title4, 530, 125)
subtitle(TitleText4, 530, 195, font=fontface, size=fontsize, text_color=textcolor, halo_color=halocolor) 
overlay(title5, 80, 250)
subtitle(TitleText5, 80, 320, font=fontface, size=fontsize, text_color=textcolor, halo_color=halocolor) 
overlay(title6, 230, 250)
subtitle(TitleText6, 230, 320, font=fontface, size=fontsize, text_color=textcolor, halo_color=halocolor) 
overlay(title7, 380, 250)
subtitle(TitleText7, 380, 320, font=fontface, size=fontsize, text_color=textcolor, halo_color=halocolor) 
overlay(title8, 530, 250)
subtitle(TitleText8, 530, 320, font=fontface, size=fontsize, text_color=textcolor, halo_color=halocolor) 
subtitle(header, 72, 85, font=fontface, size=(fontsize+10), text_color=textcolor, halo_color=halocolor) 
subtitle(nexttext, 530, 360, font=fontface, size=(fontsize+10), text_color=textcolor, halo_color=halocolor)
subtitle(maintext, 300, 360, font=fontface, size=(fontsize+10), text_color=textcolor, halo_color=halocolor)

ConvertToYV12()
Once you have the script, load it into HEnc or QuEnc (you can find these in the FAVC program directory), and generate an m2v file.

Putting it all together
Back in DVDAuthorGUI, you'll need to add the list of chapters you saved earlier. Next, you want to add a titleset menu, and point it to the menu m2v file you just created. In the titleset menu manager, you'll be able to place buttons and set actions; you'll want to make buttons for each of the videos. If you have multiple menus, you'll need to make buttons for those. For the actions, you just select them from the drop down box. After this, you can save the project and build a DVD image. All done!

What about mixed aspect videos (normal and widescreen)?
This is only slightly more complicated. To have both normal and widescreen videos display correctly, you have two options: 1) convert one to the other by adding black bars, or 2) separate the normal and widescreen videos and make a different titleset for each. The first option may be preferable if you only have one or two of one type; FAVC will convert them for you. The second option is better if you have a lot of videos, because it provides for the maximum quality.

To make different titlesets, you'll have to run FAVC twice, once for each type of video (that is, convert all your widescreen vids, then your normal aspect vids). You'll repeat the same steps for both, up until the final DVDAuthorGUI steps. You add both menus into the menu manager, but only one of the chapter lists. Under the file menu, select the option to edit the XML file before authoring. You'll have to make a few modifications here. Below is an example of the altered XML file, I'll describe the changes later.

  <titleset>
    <menus>
      <pgc pause="inf">
        <button> jump title 1 chapter  1; </button>
        <button> jump title 1 chapter  2; </button>
        <button> jump title 1 chapter  3; </button>
        <button> jump title 1 chapter  4; </button>
        <button> jump title 1 chapter  5; </button>
        <button> jump title 1 chapter  6; </button>
        <button> jump title 1 chapter  7; </button>
        <button> jump title 1 chapter  8; </button>
        <button> jump menu 2; </button>
        <button> jump titleset 2 menu; </button>
       <vob file="E:\Projects\AnimeOPED_DVD\dvdop1\dvdout\menusub1.mpg" />
      </pgc>
    </menus>
      <titles>
       <video format="ntsc" />
        <pgc>
          <vob file="C:\PATH\title1.mpg" chapters="00:00:00.00,00:01:30.15,00:02:59.85,00:04:37.00,00:06:07.00,00:07:36.89,00:09:08.00,00:10:21.00,00:13:01.68,00:14:33.57,00:16:05.70,00:17:38.05,00:19:08.34,00:20:28.09,00:22:20.17,00:23:58.63,00:25:31.09,00:27:04.50,00:28:44.40,00:30:17.80,00:32:07.50,00:33:49.36" />
          <post>jump titleset 2 title 1; </post>
        </pgc>
      </titles>
  </titleset>
  <titleset>
      <menus>
      <pgc pause="inf">
        <button> jump title 1 chapter  1; </button>
        <button> jump title 1 chapter  2; </button>
        <button> jump title 1 chapter  3; </button>
        <button> jump title 1 chapter  4; </button>
        <button> jump title 1 chapter  5; </button>
        <button> jump title 1 chapter  6; </button>
        <button> jump title 1 chapter  7; </button>
        <button> jump title 1 chapter  8; </button>
        <button> jump menu 2; </button>
        <button> jump titleset 1 menu; </button>
    <pre>if (g0==1) jump title 1 chapter 1;</pre>
       <vob file="C:\PATH\menusub4.mpg" />
    <post>g0=0;</post>
      </pgc>
    </menus>
      <titles>
       <video format="ntsc" />
        <pgc>
          <vob file="C:\PATH\title2.mpg" chapters="00:00:00.00,00:01:30.49,00:02:51.13,00:04:21.86,00:05:44.61,00:07:34.65,00:09:04.67,00:10:36.63,00:12:07.02,00:13:27.97,00:15:10.67,00:16:41.93,00:18:13.96,00:19:51.05,00:21:23.61,00:22:55.50,00:24:26.59,00:25:56.98,00:27:42.06,00:29:12.81,00:30:43.27,00:32:20.63,00:33:56.70,00:35:28.02,00:36:59.35" />
          <post>call menu 1; </post>
        </pgc>
      </titles>
  </titleset>
The XML file should be pretty self-explanatory. Basically, you need to add another titleset.

All done!
These are really just notes to myself, if somebody is actually using this as a reference, let me know and I'll flesh it out more.

No comments: