Wednesday, February 29, 2012

Play Diablo 2 in Parallel

Ok.. It is not that straight forward for me to get my Diablo 2 to play correctly in Mac Parallel.

Why Parallel? Because I can't find a way to install Diablo 2 in Lion OS...

I encounter 2 issues when I tried to launch Diablo 2 in Parallel after I had installed it via BootCamp

Before going into it, I do recommend that you allow Diablo 2 to run as administrator

1. Locate your Diablo installation folder
2. Right click Diablo II.exe -> Properties -> Compatibility Tab -> Check "Run this program as an administrator"
3. Click Ok

Problem 1: When starting Diablo 2 in Parallel, this error appear - "Error 25: Acritical error has occurred while initializing Direct3D"

This happens because Direct3D is not setup or using a old configuration

Solution:

1. Go to Start Menu -> Diablo II -> Video Test
2. Perform Video Test. It will run DirectX testes on your parallel machine.
3. At the end of the test, select Direct3D option that using your Parallel video adaptor.

Problem 2:  Graphic rendering issue during in-game in Full Screen.

After you create the game, you will see "graphic distortion" in your game. Basically, your game is not playable due to graphic issues.

Solution:

For me, I run Diablo 2 in Window mode. Due to the age of the game (best resolution is 800x600), it has some display issue when it goes into full screen. Change to window mode with the following

1. Open the properties of Diable II shortcut. Go to Start Menu -> Diablo II.
2. Right click Diablo II shortcut -> Properties
3. At Shortcut tab -> Target, you will see something like "C:\Program Files\Diablo II\Diablo II.exe". Note: this can be varies based on your Diablo 2 installation folder
4. Change the value of Target field to  "C:\Program Files\Diablo II\Diablo II.exe" -w
5. -w is a switch to tell Diable II to launch in Window mode.
6. Click Ok and Start Diablo II with the amended shortcut. You should see Diablo II launch in Window mode and the graphic issue should be gone.


Installing Diablo 2 and play without using CD

Well.. Recently, I am playing Diablo 2 again. This is just a note for me to remember how to install Diablo 2 and play without CD

1. Install Diablo 2 and follow the on-screen instruction. Make sure CD key is correct
2. Install Diablo 2: Lord of Destruction and follow the on-screen instruction. Make sure CD key is correct
3. After installation, start Diablo 2: Lord of Destruction from start menu with CD inserted
4. Log into BattleNet. This will trigger a game update.
5. After successful update, quit Diablo
6. From Diablo 2: Lord of Destruction CD, copy only d2xvideo.mpq and d2xmusic.mpq to installation forlder.
7. That all, you can start the game without CD inserted. 

Monday, February 27, 2012

MEncoder - Hardsubbing Video

MEncoder is an alternative tools for encoding video/audio and it is comparative to ffmpeg.

However, FFMPEG does not have a feature that easily help you on hardsub to video.

There are actually 3 common ways of viewing subtitles

Softsub - With an external subtitle file such as .srt file, you can view your video with a player (such as VLC) and such player will display your subtitle in the .srt file in real time. No external video processing is required

Hardsub - It means that subtitles are burnt into the video. After hardsub is done, you does not need an subtitle file for displaying subtitle. However, external video processing are often required. The video processing usually take a long time due to re-encoding of your video frames.

Subtitle Stream - This mainly applied to mp4 file. This technique actually put subtitles into your file as a separate stream. Certain video player (such as VLC) understand subtitle stream and can display them during playback. While this technique does require external video processing, it is different from Hardsub. Subtitle stream does not involve re-encoding. It is a process of putting the subtitles into the video file container format. Thus, it is way faster than hardsub. Software such as My MP4Box uses this technique.

Since subtitles stream is faster than hardsub, why do we use hardsub? The reason is simple. Not all video player support subtitle stream. Hardsub is supported for all video device as long as it support the video codec that encode the video frames.

Enough to theory, let's go back to MEncoder.

You can get binary source for MEncoder from http://oss.netfarm.it/mplayer-win32.php

Just get the correct version for your PC.

Below is a sample command for encoding your mp4 files with a subtitle file in H.264 baseline profile, level 3.0 and without B-Frame


mencoder.exe "input.mp4" -o "output_with_sub.mp4" -of lavf -oac copy -fafmttag 0x706D -ovc x264 -x264encopts nocabac:level_idc=30:bframes=0:profile=baseline -sub "subtitle.srt"

The above command take an input.mp4 (H.264 with AAC) and create an output_with_sub.mp4 with subtitle.rt in H.264 and copy the AAC audio.

Some break down of the above command

-o ---> output file

-oac ---> output audio codec

-ovc ---> output video codec


-x264encopts  ---> x264 encoder option in the format of key:value.




nocabac  ---> No context based adaptive arithmatic coding (iPhone need this)





level_idc=30  ---> H.264 level 3.0 (iPhone only up to level 3.0)





bframes=0  ---> No B-frame. (iPhone does not support B-Frame)



profile=baseline  ---> Force encoder to use baseline profile. (iPhone support baseline profile only)



-sub ---> subtitle file

-of ----> output file format

Note: When copying an AAC audio, mencoder requires you to specify -fafmttag. So far, this setting work for me -oac copy -fafmttag 0x706D

See this for further understanding http://www.mplayerhq.hu/DOCS/HTML/en/mencoder.html 

Oracle - Reclaim disk space

Oracle does not release disk space even if you had delete the data or tablespace. If you have enterprise manager, you should use it to  rec...