本來這個blog是記錄開發輸入法的點滴的,後來越來越雜,現在什麼都記錄了。

2014年12月26日 星期五

How to fix the color problem in the idx / sub file?

How to fix the color problem in the idx / sub file?

Sometimes, even the trick of changing the palette:

palette: 000000, 000000, 000000, ffffff, ffffff, ffffff, ffffff, ffffff, ffffff, ffffff, ffffff, ffffff, ffffff, ffffff, ffffff, 000000

 in idx file, there are still problem in the subtitle. Using SubResync in VobSub, some of the subtitle, some of subtitle look ugly:




To fix this:
  1. With subresync, save the final.idx / final.sub as DVDMaestro format.

     
  2. You will see final.son, final.spf (palette) and some bitmaps.

     
  3. Open the bitmap file, you will see something like this:


    Open it with image editor (e.g. GIMP)  it is noted it is a bitmap with 16 color palette.
    But only 4 of color palette entries are used.

     

    The 4 colors are: 0x0000ff00 (blue), 0xff000000 (red), 0x00000000 (black) and 0xffffff00 (white)

    We are using this color palette for the subtitle. This color palette must be saved in final.spf.

    With notepad, save the following to a text file final.spf.xxd:

    0000000: 0000 ff00 ff00 0000 0000 0000 ffff ff00 ................
    0000010: ffff ff00 ffff ff00 ffff ff00 ffff ff00 ................
    0000020: ffff ff00 ffff ff00 ffff ff00 ffff ff00 ................
    0000030: ffff ff00 ffff ff00 ffff ff00 ffff ff00 ................

    Using xxd (link) to convert it to final.spf.

    xxd -r < final.spf.xxd > final.spf
     
  4. Fix the final.son  so that the color palette is fixed.
     
    st_format 2
    Display_Start non_forced
    TV_Type PAL
    Tape_Type NON_DROP
    Pixel_Area (0 573)
    Directory .
    Subtitle final
    Display_Area (0 2 719 575)
    Contrast (15 15 15 0)

    SP_NUMBER START END FILE_NAME
    Color (1 3 0 9)
    Contrast (4 15 0 15)

    0001 00:03:02:12 00:03:05:02 final_0001.bmp
    Color (12 15 0 9)
    Contrast (15 15 0 15)

    0002 00:03:05:05 00:03:07:08 final_0002.bmp
    Color (12 2 0 14)
    0003 00:03:07:10 00:03:11:08 final_0003.bmp
    Color (1 3 0 9)
    Contrast (4 15 0 15)
    0004 00:03:11:16 00:03:14:11 final_0004.bmp
    Color (3 2 0 3)
    Contrast (15 15 0 15)
    0005 00:03:15:05 00:03:17:07 final_0005.bmp
    Color (9 2 0 15)
    0006 00:03:17:10 00:03:21:01 final_0006.bmp
    Color (1 3 0 9)
    Contrast (4 15 0 15)
    0007 00:03:21:03 00:03:23:03 final_0007.bmp
     

    The lines in red above caused the wrong subtitle used. So modify it to something like:
     
    st_format 2
    Display_Start non_forced
    TV_Type PAL
    Tape_Type NON_DROP
    Pixel_Area (0 573)
    Directory .
    Subtitle final-2
    Display_Area (0 2 719 575)
    Contrast (15 15 0 15)
    Color (1 2 0 3)

    SP_NUMBER START END FILE_NAME
    0001 00:03:02:12 00:03:05:02 final-2_0001.bmp
    0002 00:03:05:05 00:03:07:08 final-2_0002.bmp
    0003 00:03:07:10 00:03:11:08 final-2_0003.bmp
    0004 00:03:11:16 00:03:14:11 final-2_0004.bmp
    0005 00:03:15:05 00:03:17:07 final-2_0005.bmp
    0006 00:03:17:10 00:03:21:01 final-2_0006.bmp
    0007 00:03:21:03 00:03:23:03 final-2_0007.bmp
    0008 00:03:23:08 00:03:27:00 final-2_0008.bmp
    0009 00:03:27:12 00:03:29:13 final-2_0009.bmp
    0010 00:03:29:15 00:03:30:23 final-2_0010.bmp
    0011 00:03:37:06 00:03:40:14 final-2_0011.bmp
    0012 00:03:40:16 00:03:41:21 final-2_0012.bmp
    0013 00:03:44:09 00:03:47:06 final-2_0013.bmp
    0014 00:03:47:09 00:03:50:01 final-2_0014.bmp
    0015 00:03:50:02 00:03:51:02 final-2_0015.bmp
    0016 00:03:51:04 00:03:53:08 final-2_0016.bmp
    ...

    Note: index 0 is the transparent color.

  5. Download SON2VOBSUB. Open the final.son. Change the height to 576.



    Click Convert.
     
  6. Reopen final.idx with subresync. The subtitle is fixed.

     

 

沒有留言: