VideoHelp Forum




+ Reply to Thread
Results 1 to 11 of 11
  1. Member
    Join Date
    Dec 2009
    Location
    Canada
    Search Comp PM
    Hey, a while ago I came across an effect applied to a webcam stream through Flash, then it wasn't where it used to be anymore and just a few hours ago I found someone who knows how to create the effect in Flash

    http://www.adobe.com/devnet/flash/articles/webcam_motion.html

    Here's the zip with the swf and fla files:
    http://download.macromedia.com/pub/developer/webcam_old_new.zip
    webcam.swf is the one I'm interested in.

    But there are many inconveniences with flash, such as small size(the bigger the laggier it will get), the slow framerate and having to record it and cut out the needed area of the screen.

    So I was wondering, is there any software out there that has a similar effect for videos? Or anything similar at all?

    Would be greatly appreciated.
    Quote Quote  
  2. It can be done with AviSynth filters. Something like this:

    Code:
    src=AVISource("small.avi")
    
    diff=Overlay(Trim(src,1,0), src, mode="Difference").ColorYUV(off_y=-128).ColorYUV(gain_y=256)
    
    f0=diff.ColorYUV(off_y=-200)
    f1=Trim(diff,1,0).ColorYUV(off_y=-150)
    f2=Trim(diff,2,0).ColorYUV(off_y=-100)
    f3=Trim(diff,3,0).ColorYUV(off_y=-50)
    f4=Trim(diff,4,0)
    
    acc=Overlay(f0, f1, mode="add")
    acc=Overlay(acc, f2, mode="add")
    acc=Overlay(acc, f3, mode="add")
    acc=Overlay(acc, f4, mode="add")
    
    return(ConvertToRGB(acc)).RgbAdjust(r=-255, b=-255)
    The critical function here is the first Overlay(Trim(src,1,0), src, mode="Difference"). That subtracts one frame from the next resulting in only differences between frames. The rest of the script is there to approximate the green image and trails.

    -->
    Quote Quote  
  3. Member
    Join Date
    Dec 2009
    Location
    Canada
    Search Comp PM
    Oh wow, words cannot express my gratitude, thank you so much!
    Gonna go try that.
    Quote Quote  
  4. Member
    Join Date
    Dec 2009
    Location
    Canada
    Search Comp PM
    I don't have any experience with AviSynth, what I tried was I made a file video1.avs and put the following inside:

    DirectShowSource("c:\Program Files\AviSynth 2.5\Examples\video1.avi")
    src=AVISource("video1.avi")

    diff=Overlay(Trim(src,1,0), src, mode="Difference").ColorYUV(off_y=-128).ColorYUV(gain_y=256)

    f0=diff.ColorYUV(off_y=-200)
    f1=Trim(diff,1,0).ColorYUV(off_y=-150)
    f2=Trim(diff,2,0).ColorYUV(off_y=-100)
    f3=Trim(diff,3,0).ColorYUV(off_y=-50)
    f4=Trim(diff,4,0)

    acc=Overlay(f0, f1, mode="add")
    acc=Overlay(acc, f2, mode="add")
    acc=Overlay(acc, f3, mode="add")
    acc=Overlay(acc, f4, mode="add")

    return(ConvertToRGB(acc)).RgbAdjust(r=-255, b=-255)

    then put a video1.avi into the same folder, open the avs file with windows media player, but it says it couldn't open video1.avi
    That's probably not the way it's supposed to be done at all, can you tell me how it's actually done?
    Quote Quote  
  5. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Remove the first line (DirectShowSource(...)).
    Quote Quote  
  6. Member
    Join Date
    Dec 2009
    Location
    Canada
    Search Comp PM
    Same thing, just different error message.
    And if I have to upload the video somewhere, youtube for example, I wouldn't be uploading the .avs, right? There should be a way to merge them somehow.
    Quote Quote  
  7. You would not upload the the AVS script. You would use an editor like VirtualDub to open the AVS script and encode to a new video file. Then upload that file to YouTube.

    Regarding your problem:

    1) put the AVS script and the AVI file in the same folder. Your AVS script should start with:

    Code:
    src=AVISource("video1.avi")
    where "video1.avi" is the name of the AVI file. If your source isn't an AVI file you will need to use a different command. You must also have a VFW decoder for whatever video codec is used in your AVI file. If you don't have a VFW decoder you can try using DirectShowSource("video1.avi") intead of AviSource("video1.avi").

    2) Open the AVS script with VirtualDub or some other editor that supports AVS scripts. Most media players will accept an AVS script too. But this script may be too intensive for a media player to playback in realtime.
    Quote Quote  
  8. Member
    Join Date
    Dec 2009
    Location
    Canada
    Search Comp PM
    Ahahahaha, I can't believe this. Basicly, the file name I was putting into the filter was Family.avi (an episode of family guy, the name of which I cut down for simplicity during testing) and the whole time it was giving me an error about being unable to load it and by some chance I decided to edit the name again and noticed that after Family there was a space(Family .avi).
    Works good now, thanks.

    Actually, for some reason when playing it through the filter there's quiet a bit of audio delay.
    Tried it on different .avi and .wmv files, causes the delay everywhere.
    Can anything be done about that?
    Quote Quote  
  9. As noted, your processor probably isn't fast enough to deal with that script in realtime. It shouldn't be an issue if you encode with an editor.
    Quote Quote  
  10. Member
    Join Date
    Dec 2009
    Location
    Canada
    Search Comp PM
    Alright, a quick question than, after opening the .avs with VirtualDub, how do I encode it?
    Digging through it right now, can't seem to find a way.

    Never mind, found the save as .avi button.
    Quote Quote  
  11. You'll want to use some compression codec or you'll get really big files. Video -> Compression... select codec and set its parameters. There are many VirtualDub guides in the guide section.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!