Post subject: FreeSub (custom subtitles plugin by natt)
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
natt wrote:
A crappy subtitle renderer I wrote for avisynth. Watch any of my recent normal/hi10/512 encodes (of older consoles); that's what it looks like. http://www.mediafire.com/?h6fc11dc1w8g1mp
It uses bitmap fonts, that are being put over the video without any resizing. If you specify subsize above one, they are upscaled by neares neighbour by that factor. Halo size is set separately and looks better when is twice bigger than the text size. I started using this function as it is awesome for both SD and HD, so no need for this slow ng_bighalo, because you just resize by 8 for HD. Pack of fonts (with the preview program) can be obtained from my Encoding Package. The plugin and readme are included. http://code.google.com/p/feos-tas/downloads/detail?name=TASEncodingPackage.7z Here is how it is used in code:
Language: avisynth

LoadCPlugin("./programs/freesub.dll") fontfile = "./fonts/helvB10.bdf" subsize = 1 halosize = 2 FreeSub( \ game + "\n" + ( \ (branch == "") ? "" : branch + "\n" \ ) + "Played by " + author + "\nPlaying time: " + \ time + "\nRerecord count: " + rerecords, y=(ypos * factor), \ font=fontfile, halo_width=(halosize * factor), halo_height=(halosize * factor), \ align=position, first_frame=subff, last_frame=(subff + sublength), \ size=(subsize * factor), text_color=$00FFFFFF, halo_color=$00000000, lsp=2 \ )
My font and natt's font accordingly. This is after ARC.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Player (66)
Joined: 4/21/2011
Posts: 232
The plugin and readme are included.
You forgot the plugin.
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
It is in the "programs" folder. That's what I forgot to say.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Player (66)
Joined: 4/21/2011
Posts: 232
I tied this together with new improved bighalo. updated: http://pastebin.com/hiBwTHrK
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Could you post a snapshot? I'm bad at testing others' scripts. Also I stopped using bitmap fonts for HD (haven't uploaded anything after that yet).
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Player (66)
Joined: 4/21/2011
Posts: 232
This halo draws faster since I'm only using some of the points of the circle rather than the whole thing. (click for full size)
Language: avisynth

import("C:\mf\NGcode\lib\NGcode.avs") blankclip(1,256*8,8*224,color=$0000ffff) ng_sub
Language: avisynth

import("C:\mf\NGcode\lib\NGcode.avs") blankclip(1,256,224,color=$0000ffff) ng_sub
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
But you don't need bighalo for freesub, since its halo is already adjustable (I use 2).
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Player (66)
Joined: 4/21/2011
Posts: 232
The goal with the new command is to pick the font based on the dimensions. So it automatically uses freesub with SD and bighalo with HD. Bigger halos? Do you like the drop shadow?
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Automated the size choice:
Language: avisynth

subFont = "helvR" subSize = (last.width <= 240) ? 8 : 10 subFontFile = "./fonts/" + subFont + String(subSize) + ".bdf"
and
Language: avisynth

hd ? ng_bighalo( \ subString1, x=(subXpos * factor), y=(subYos * factor), \ align=subAlign, first_frame=subFF, last_frame=(subFF + subLength), \ size=(subSize * factor), text_color=$00FFFFFF, halo_color=$00000000, lsp=2 \ ) : FreeSub( \ subString1, x=(subXpos * factor), y=(subYos * factor), \ font=subFontFile, halo_width=(subHaloSize * factor), halo_height=(subHaloSize * factor), \ align=subAlign, first_frame=subFF, last_frame=(subFF + subLength), \ size=factor, text_color=$00FFFFFF, halo_color=$00000000, lsp=2 \ )
Updated: http://code.google.com/p/feos-tas/downloads/detail?name=TASEncodingPackage.7z
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Player (66)
Joined: 4/21/2011
Posts: 232
You can replace bighalo with this one http://pastebin.com/hpufrFFT I've only looked at 256x224 and 8 times that, so I don't have anything working for a more general case.