1 2
8 9
Player (66)
Joined: 4/21/2011
Posts: 232
The blinkmask is working pretty well. But the shakemask I need in the metroid clip is giving me trouble. road runner http://www.youtube.com/watch?v=tdLJQYwHMXw street fighter http://www.youtube.com/watch?v=tlUc4s0xkMs super metroid http://www.youtube.com/watch?v=90sL_0bAiWc
converttorgb32

e0=selectevery(4,0)
o1=selectevery(4,1)
e2=selectevery(4,2)
o3=selectevery(4,3)

i2=layer(e2,o1.mask(blinkmask.converttorgb32))
#interleave(e0,o1,i2,o3)
#i2=layer(i2,o1.mask(shakemask.converttorgb32))

interleave(e0,i2)
pointresize(width * 2, height *2)
ConvertToYV24(chromaresample="point", matrix=("PC.601") )
ConvertToYV12(chromaresample="point", matrix=("PC.601") )

function blinkmask(clip c,int "ml"){
    ml=default(ml,128)
    src=c.ConvertToYv12
    super=MSuper(src, pel=1)
    fvec =MAnalyse(super, isb=false, blksize=4)
    bvec =MAnalyse(super, isb=true , blksize=4)
    fmask=Mmask(src,fvec,kind=1,ml=ml).mt_binarize(u=-128,v=-128)
    bmask=Mmask(src,bvec,kind=1,ml=ml).mt_binarize(u=-128,v=-128)

    eo0_to =fmask.selectevery(4,1)
    oe_from=bmask.selectevery(4,1)
    front  =mt_logic(eo0_to,oe_from,mode="and")

    oe_to  =fmask.selectevery(4,2)
    eo_from=bmask.selectevery(4,2)
    back   =mt_logic(oe_to,eo_from,mode="and")

    ee_src=src.selecteven
    ee_super=MSuper(ee_src, pel=1)
    ee_fvec =MAnalyse(ee_super, isb=false, blksize=4)
    ee_bvec =MAnalyse(ee_super, isb=true , blksize=4)
    ee_fmask=Mmask(ee_src,ee_fvec,kind=1,ml=ml).mt_binarize(u=-128,v=-128)
    ee_bmask=Mmask(ee_src,ee_bvec,kind=1,ml=ml).mt_binarize(u=-128,v=-128)

    ee_to  =ee_fmask.selectevery(2,1)
    ee_from=ee_bmask.selectevery(2,0)
    ee     =mt_logic(ee_to,ee_from,mode="or")

    oo_src=src.selectodd
    oo_super=MSuper(oo_src, pel=1)
    oo_fvec =MAnalyse(oo_super, isb=false, blksize=4)
    oo_bvec =MAnalyse(oo_super, isb=true , blksize=4)
    oo_fmask=Mmask(oo_src,oo_fvec,kind=1,ml=ml).mt_binarize(u=-128,v=-128)
    oo_bmask=Mmask(oo_src,oo_bvec,kind=1,ml=ml).mt_binarize(u=-128,v=-128)

    oo_to  =oo_fmask.selectevery(2,1)
    oo_from=oo_bmask.selectevery(2,0)
    oo     =mt_logic(oo_to,oo_from,mode="or")

    #to e0-o1, from o1-e2, nothing e0-e2
    unblink=mt_logic(front,ee.mt_invert,mode="and")

    #to o1-e2, from e2-o3, nothing o1-o3
    blink  =mt_logic(back,oo.mt_invert,mode="and")

    return mt_logic(blink,unblink,mode="or")
}

function shakemask(clip c){
    e0=c.selectevery(4,0)
    o1=c.selectevery(4,1)
    e2=c.selectevery(4,2)
    o3=c.selectevery(4,3)
    e4=c.selectevery(4,4)

    ee1=ng_same(e0,e2).mt_inpand
    ee2=ng_same(e2,e4).mt_inpand
    oo=ng_same(o1,o3).mt_inpand

    mask=mt_logic(ee1,ee2,mode="or")
    return mt_logic(mask,oo,mode="and")
}

function ng_same(clip A, clip B, int "thr"){
    thr=default(thr,0)
    TAD=ng_TAD(A,B)
    return mt_binarize(TAD, threshold=thr, upper=true)
}

function ng_TAD(clip A, clip B){
    R=ng_AD(A  .showRed("YV12"),B  .showRed("YV12"))
    G=ng_AD(A.showGreen("YV12"),B.showGreen("YV12"))
    B=ng_AD(A .showBlue("YV12"),B .showBlue("YV12"))
    return ng_plus(R, ng_plus(G, B))
}

function ng_AD(clip A, clip B){
    return mt_lutxy(A,B,"x y - abs")
}

function ng_plus(clip A, clip B){
    return mt_lutxy(A,B,"x y +")
}
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
There is also a part in the current Gunstar Heroes TAS when there are some letters drawn on the screen with fire, the flame interestingly blinks, and due to fast drawing, converting to 24 fps makes these letters very hardly readable. UPDATE: Here are two clips for testing. I added Mega Turican as well because it has this odd blinking green shell, different each frame. http://www.mediafire.com/?pb75g7ygh7zs4jb http://www.mediafire.com/?tnlmh425j2tg31n
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
Those seem to work ok. A trim(1,0) was needed for the Turrican, I guess it is easier to overlay the larger sprite than try to cover it up. Gunstar Turrican
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Turrican looks fine, though check this part of the video: The round turns into a square after processing. And here is some Super Contra madness: http://www.mediafire.com/?s3zfmswaa5tjftn
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.
Active player (279)
Joined: 4/30/2009
Posts: 791
Does someone want to try tackling a full encode of Alisia Dragoon to see what they can do there? While this focus on parts of a video is fine, we need to apply this to more complete TASes to get the full effect, I feel.
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
The method is still being improved, so you better suggest some scenes from Alisia Dragoon to test as I did.
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
feos wrote:
The round turns into a square after processing.
You won't be able to do blinking and the round. TASblend would probably be a good compromise there, but it might mess up the motion in the rest of the scene. A version that turns just the blinking into transparency should be possible. Baxter
Player (66)
Joined: 4/21/2011
Posts: 232
Toothache wrote:
Alisia Dragoon
I pulled the mp4 off of archive. Is the frame rate really 48.9, or has it been dedupped or something?
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
nanogyth wrote:
Baxter
Oh, that's unbelievable!!! Perfect work!
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.
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Uncommenting this line
#i2=layer(i2,o1.mask(shakemask.converttorgb32))
I got "Dunno WTF is i2" error. Fix the line to what you meant it to be please.
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
i2=layer(e2,o1.mask(blinkmask.converttorgb32))
#interleave(e0,o1,i2,o3)
#i2=layer(i2,o1.mask(shakemask.converttorgb32)) 
i2 is defined in the first line. If your source has shaking you should leave the first line as is and uncomment the 2nd and 3rd lines.
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Ah, thanks.
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.
Joined: 2/15/2009
Posts: 329
Toothache wrote:
Does someone want to try tackling a full encode of Alisia Dragoon to see what they can do there? While this focus on parts of a video is fine, we need to apply this to more complete TASes to get the full effect, I feel.
Like this?
Working on: Legend of Legaia, Vagrant Story
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Toothache wrote:
Does someone want to try tackling a full encode of Alisia Dragoon to see what they can do there? While this focus on parts of a video is fine, we need to apply this to more complete TASes to get the full effect, I feel.
I've made an HD encode of your Alisia, but when I logged into my second YT account, I suddenly found it was capped again for NO reason. I can try to seed this file to you to upload & replace the official YT encode for the publication, as it looks awesome.
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.
Active player (279)
Joined: 4/30/2009
Posts: 791
Sounds good. Send me a torrent file and I'll put it on my YT.
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Already seeding it to Brandon. And the link to the .torrent file was put into my PM to you (last one).
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.
Editor, Expert player (2072)
Joined: 6/15/2005
Posts: 3282
As an example of my approach, here is what I used for the Gekisou Sentai Car Ranger encode to Youtube:
function Blend(clip c, float oa)  { 
Layer(SelectEvery(c, 2, 0), SelectEvery(c, 2, 1), level=int(round(oa * 257)))
}

function Blend2(clip c, float oa)  { 
Layer(SelectEvery(c, 2, -1), SelectEvery(c, 2, 0), level=int(round(oa * 257)))
}

function Blend3(clip c, float oa)  { 
Interleave(Layer(SelectEvery(c, 4, 0), SelectEvery(c, 4, 1), level=int(round(oa * 257))), 
        \          Layer(SelectEvery(c, 4, 2), SelectEvery(c, 4, 3), level=int(round((1.0 - oa) * 257))))
}

AVISource("z.avi")
b=ConvertToRGB32()
AVISource("gekisoulogo.avi")
ConvertToRGB32()
logo=ResampleAudio(48000)
logo=monotostereo(logo,logo)
logo++b

text="Gekisou Sentai Car Ranger TAS\nTime: 6:56.90\nRerecords: 7746\nAuthor: FractalFusion"
subtitle(text,-1,0,771,1071, "Arial", 14, $FFFFFF, lsp=1, align=8)

text="This is a tool-assisted recording.\nFor more information,\nsee http://TASVideos.org/"
b=subtitle(text,-1,0,1071,1371, "Arial", 14, $FFFFFF, lsp=1, align=8)

x1=Trim(b,0,11719)
x2=Trim(b,11720,25403)
x3=Trim(b,25404,27033)
x4=Trim(b,27034,27099)
x5=Trim(b,27100,33380)

y1=Blend(x1,0.75)
y2=Blend2(x2,0.75)
y3=Blend(x3,0.75)
y4=Blend3(x4,0.55)
y5=Blend(x5,0.75)

y1++y2++y3++y4++y5
#27033-27099

#SelectEvery(1,0,0)
#StackHorizontal(b)
I use a simple
...|ev|od|ev|od|...
...|33|66|33|66|...
...|     |     |...
as the function Blend. Without regard to flicker, this gives a suitable interpolation of motion. The function Blend2 is the same as Blend, but with even and odd frames reversed. This is useful in some cases. When my character takes damage, the game uses a 3 on 1 off flicker pattern. So Blend might come up with the following situation:
...|1 |1 |0 |1 |1 |1 |0 |1 |...
...|33|66|33|66|33|66|33|66|...
...| 100 | 66  | 100 | 66  |... 
So there is not much flicker. However, if I reverse the parity by using Blend2:
...|1 |1 |1 |0 |1 |1 |1 |0 |...
...|33|66|33|66|33|66|33|66|...
...| 100 | 33  | 100 | 33  |... 
Here, the flicker is more pronounced. Finally, I use
...|33|66|66|33|33|66|66|33|...
...|     |     |     |     |... 
for the 30Hz flicker scene of the Earth turning into fireworks. I chose the parameters 0.75 (75%) for Blend and Blend2. To me this seems to have the best tradeoff between motion and blur. I chose the parameter 0.55 (55%) for Blend3; I chose not to portray a full-effect flicker due to seizure considerations. For a full-effect flicker at 15Hz, the parameter 1.00 (100%) is used. The flicker level I chose is 10x weaker. To apply the various blends, I cut the clip into pieces with Trim, applied the appropriate Blend to each one, then spliced them back together. The SelectEvery and StackHorizontal at the end are commented out; when not, these are used to help compare the frame-blended 30fps video with the original 60fps. Anyway, the message here is that one single method cannot handle all the deficiencies of 30fps. For example, see this issue regarding site TASBlend. I find it easier to adjust the video carefully based on particular segments, applying appropriate blends to each one. Edit: Changed TASBlend to Blend.
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
FractalFusion wrote:
Note: The use of "TASBlend" here does not coincide with the site's use of "TASBlend".
Then it'd be better for clarity to use another name...
text1 = "Gekisou Sentai Car Ranger TAS\nTime: 6:56.90\nRerecords: 7746\nAuthor: FractalFusion"
text2 = "This is a tool-assisted recording.\nFor more information,\nsee http://TASVideos.org/"

AVISource("logo.avi").ConvertToRGB32.ResampleAudio(48000)
MonoToStereo(last, last) + AVISource("game.avi").ConvertToRGB32

Subtitle(text1, -1, 0,  771, 1071, "Arial", 14, $FFFFFF, lsp=1, align=8)
Subtitle(text2, -1, 0, 1071, 1371, "Arial", 14, $FFFFFF, lsp=1, align=8)

Trim(    0, 11719).   Blend1(0.75) +\
Trim(11720, 25403).   Blend2(0.75) +\
Trim(25404, 27033).   Blend1(0.75) +\
Trim(27034, 27099).TASBlend_(0.55) +\
Trim(27100,     0).   Blend1(0.75)




function Blend1(clip c, float oa)  {Layer(SelectEvery(c, 2,  0), SelectEvery(c, 2, 1), level=int(round(oa * 257)))}
function Blend2(clip c, float oa)  {Layer(SelectEvery(c, 2, -1), SelectEvery(c, 2, 0), level=int(round(oa * 257)))}


function TASBlend_(clip c, float oa)  {
        Interleave(Layer(SelectEvery(c, 4, 0), SelectEvery(c, 4, 1), level=int(round((      oa) * 257))), 
        \          Layer(SelectEvery(c, 4, 2), SelectEvery(c, 4, 3), level=int(round((1.0 - oa) * 257))))
}
(btw. the two subtitles overlap for one frame)
1 2
8 9