VideoHelp Forum
+ Reply to Thread
Results 1 to 30 of 30
Thread
  1. Hello,
    i just started ripping using megui to mkv x264 rips. I was wondering if i can add watermark while ripping. Using vdub logo filter or something i have seen a sample on few web sites but couldn't able to get it work.

    this what i got so far

    DGDecode_mpeg2source("C:\videos/VTS_02_1.d2v", info=3)
    ColorMatrix(hints=true, interlaced=true, threads=0)
    tfm(order=1).tdecimate(hybrid=3)
    crop( 4, 60, -4, -54)

    LanczosResize(640,272) # Lanczos (Sharp)
    Undot() # Minimal Noise
    {
    LoadVirtualdubPlugin("C:\Program Files (x86)\VirtualDub\Plugins"
    \ +"\logo.vdf", "_VD_Logo", 1)
    return clip._VD_Logo(default(x,0), default(y,0), default(alpha,128),
    \ default(transparent,true)?1:0, default(xr,0), default(xg,0),
    \ default(xb,255),default(tolerance,0), default
    \ (filename,VirtualDub_plugin_directory+"\logo.bmp") ,
    \ default(animate,false)?1:0, default(start,0), default(duration,0),
    \ default(loops,0),default(fadeinlen,0),
    \ default(fadeoutend,200), default(fadeoutlen,0))
    }
    ConvertToRGB()
    VD_logo(0,0,128,true,0,0,0,0,"C:\Pictures\logo.bmp ",false,100,500,0,100,500,100)
    ConvertToYUY2()
    Quote Quote  
  2. Mod Neophyte Super Moderator redwudz's Avatar
    Join Date
    Sep 2002
    Location
    USA
    Search Comp PM
    Most all VirtualDub logo filters are to remove those incredibly irritating logos, not add them. But someone here may have an idea.

    'Ripping' is generally the process of making an exact copy of a file, usually as in transferring a DVD VIDEO_TS folder to your computer's hard drive. What you are doing appears to be encoding or re-encoding the file to a different format.

    And that's not editing. Moving you to Newbie/General Forum.

    And welcome to our forums.

    EDIT: You might check this discussion: http://neuron2.net/board/viewtopic.php?t=921 Also this: http://neuron2.net/logo/logo.html
    Quote Quote  
  3. Since you're already using AviSynth just use the Overlay() or Layer() filters.
    Quote Quote  
  4. Originally Posted by jagabo
    Since you're already using AviSynth just use the Overlay() or Layer() filters.
    can you able to help me with it
    Quote Quote  
  5. A=ImageSource("C:\Path\To\Logo.bmp")
    A=A.ConvertToYV12()
    B=MPEG2Source("C:\videos\VTS_02_1.d2v")
    Overlay(B,A,X=xxx,Y=yyy)

    where xxx and yyy are the coordinates where it should be applied. If you just want it in the upper left corner, you don't need 'X=xxx,Y=yyy'. And you don't need the ColorMatrix filter, unless maybe you're starting with a hi-def source and downsizing to standard def. Let us know if you have any problems. However, like redwudz I hate user applied logos with a passion. Unless you have a very good reason for applying one, I'd recommend forgetting about it.

    http://avisynth.org/mediawiki/Overlay

    Also, you should always open your scripts in VDub(Mod) for testing. It'll give out with an error message to help pinpoint what's wrong. You just telling us that it didn't work isn't good enough. In the case of your script above, it would have immediately pointed to the first line because you have a slash facing the wrong way:

    DGDecode_mpeg2source("C:\videos/VTS_02_1.d2v", info=3)
    Quote Quote  
  6. Member PuzZLeR's Avatar
    Join Date
    Oct 2006
    Location
    Toronto Canada
    Search Comp PM
    Another tool to help you position and preview the image in the script, with trial and error, is AvsP.

    As well, I notice in your script, and I'm assuming, you're dealing with a wide screen film source.

    As for this line be careful:
    tfm(order=1).tdecimate(hybrid=3)

    Your audio could end up out of sync as there may be too slow a framerate for it. If so, use hybrid=1 instead.

    And for:
    crop( 4, 60, -4, -54)
    LanczosResize(640,272)

    I'd need to see the source, but it seems off to me. Either you're not cropping enough, or you could add more pixels to the height. It could still work, but may not be as efficient an encode or could throw off the aspect ratio. Like I said, I can't see the source so I'm guessing.
    I hate VHS. I always did.
    Quote Quote  
  7. it did convert without a problem but then when i looked at the video after converting there was no watermark
    Quote Quote  
  8. Originally Posted by rippergreat
    it did convert without a problem but then when i looked at the video after converting there was no watermark
    Then you did something wrong. Post your avs script.

    You should always preview your script before encode, so you don't waste time. If the watermark isn't in the preview, it obviously isn't going to be in the final conversion. You preview it in mpc, avsp, vdub etc... or even the megui preview window.

    What kind of watermark? Is it a solid .bmp or does it have alpha channel (transparency)? Is it the same size of the video frame or different? Do you want it on all the frames or just a few?
    Quote Quote  
  9. this was my script

    DGDecode_mpeg2source("C:\Documents\Videos\VTS_02_1 .d2v", info=3)
    ColorMatrix(hints=true, interlaced=true, threads=0)
    tfm(order=1).tdecimate(hybrid=3)

    function VD_Logo(clip clip, int "x", int "y", int "alpha", bool "transparent",
    \ int "xr", int "xg", int "xb", int "tolerance", string "filename",
    \ bool "animate", int "start", int "duration", int "loops",
    \ int "fadeinlen", int "fadeoutend", int "fadeoutlen")
    {
    LoadVirtualdubPlugin("C:\VirtualDub\Plugins"
    \ +"\logo.vdf", "_VD_Logo", 1)
    return clip._VD_Logo(default(x,0), default(y,0), default(alpha,128),
    \ default(transparent,true)?1:0, default(xr,0), default(xg,0),
    \ default(xb,255),default(tolerance,0), default
    \ (filename,""),
    \ default(animate,false)?1:0, default(start,0), default(duration,0),
    \ default(loops,0),default(fadeinlen,0),
    \ default(fadeoutend,200), default(fadeoutlen,0))
    }
    ConvertToRGB()
    VD_logo(382,435,240,true,0,0,0,10,"C:\VirtualDub\P lugins\T.bmp",false,1067,0,0,30,1419,13)
    ConvertToYV12()

    crop( 4, 58, -4, -54)

    LanczosResize(640,272) # Lanczos (Sharp)
    Undot() # Minimal Noise
    Quote Quote  
  10. Why do you insist on using VirtualDub's logo filter? Use AviSynth's Overlay() instead. It's much simpler. Here's a script including an alpha mask:

    myvideo=AVISource("source.avi")
    myoverlay=ImageSource("Logo.bmp")
    mymask=ImageSource("Mask.bmp")

    Overlay(myvideo, myoverlay, 48, 48, mymask)
    Obviously, replace the X and Y coordinates with your desired location.

    Here's a sample with a simple 50 percent opacity:
    myvideo=AVISource("source.avi")
    myoverlay=ImageSource("Logo.bmp")

    Overlay(myvideo, myoverlay, 48, 48, opacity=0.5)
    Quote Quote  
  11. Originally Posted by jagabo
    Why do you insist on using VirtualDub's logo filter? Use AviSynth's Overlay() instead. It's much simpler. Here's a script including an alpha mask:

    myvideo=AVISource("source.avi")
    myoverlay=ImageSource("Logo.bmp")
    mymask=ImageSource("Mask.bmp")

    Overlay(myvideo, myoverlay, 48, 48, mymask)
    Obviously, replace the X and Y coordinates with your desired location.
    so basically i just need to add to the existing script like this



    DGDecode_mpeg2source("C:\Documents\Videos\VTS_02_1 .d2v", info=3)
    ColorMatrix(hints=true, interlaced=true, threads=0)
    tfm(order=1).tdecimate(hybrid=3)

    myoverlay=ImageSource("Logo.bmp")
    mymask=ImageSource("Mask.bmp")

    Overlay(myvideo, myoverlay, 48, 48, mymask)

    crop( 4, 58, -4, -54)

    LanczosResize(640,272) # Lanczos (Sharp)
    Undot() # Minimal Noise
    Quote Quote  
  12. Close, but remove myvideo from the Overlay function since you are using the default video:

    Overlay(myoverlay, 48, 48, mymask)
    Quote Quote  
  13. also what is Mask.bmp
    Quote Quote  
  14. Mask is an alpha channel. It's an image that indicates how transparent each pixel of the logo is (same size as the logo). Black is completely transparent, white is completely opaque and grays in between are varying levels of transparency.

    Note, I added a simple opacity example earlier.
    Quote Quote  
  15. it works thanks
    Quote Quote  
  16. is it possible to do like timing comes on certain time then goes off
    Quote Quote  
  17. Originally Posted by rippergreat
    is it possible to do like timing comes on certain time then goes off
    Probably with the use of the SelectRangeEvery command. You could fade it in and out as well:

    http://avisynth.org/mediawiki/SelectRangeEvery
    http://avisynth.org/mediawiki/Fade

    If you can't figure out how to use them yourself, give us your current script, how often you want the logo to appear and how long you want it to stay on. And if you want it faded, how much time for the fade in/out? The framerate of the video would also be helpful.
    Quote Quote  
  18. You can also trim your video into segments and apply the overlay to only chosen segments:

    Code:
    myvideo=AVISource("source.avi")
    myoverlay=ImageSource("Logo.bmp")
    seg1=trim(myvideo, 0, 99) #frames 0 to 99
    seg2=trim(myvideo, 100, 0) #frames 100 to end
    
    return(Overlay(seg1, myoverlay, 48, 48, opacity=0.5)+seg2)
    Quote Quote  
  19. im directly importing the video so i don't have myvideo part
    Quote Quote  
  20. You have to define what "myvideo" is, so instead of AVISource, use MPEG2Source in your example:

    DGDecode_mpeg2source("C:\Documents\Videos\VTS_02_1 .d2v", info=3)
    ColorMatrix(hints=true, interlaced=true, threads=0)
    tfm(order=1).tdecimate(hybrid=3)
    myvideo=last

    So the stuff before the last line refers to the input video, and from now on it's called "myvideo" for the rest of the script. It's just a variable name. You could have just as easily called it something else
    Quote Quote  
  21. Originally Posted by poisondeathray
    You have to define what "myvideo" is, so instead of AVISource, use MPEG2Source in your example:

    DGDecode_mpeg2source("C:\Documents\Videos\VTS_02_1 .d2v", info=3)
    ColorMatrix(hints=true, interlaced=true, threads=0)
    tfm(order=1).tdecimate(hybrid=3)
    myvideo=last

    So the stuff before the last line refers to the input video, and from now on it's called "myvideo" for the rest of the script. It's just a variable name. You could have just as easily called it something else
    or so basically now everything before myvideo is called myvideo? including the mpeg source?
    Quote Quote  
  22. Yes in that example script, the 3 previous lines refer to your video. You still have to add the other stuff like cropping and overlay, trim etc... You might even add the resize and crop before the "myvideo=last" line, depending on what dimensions your overlay was

    If you called it "mysupercoolvideo=last", those lines would now be called "mysupercoolvideo"
    Quote Quote  
  23. If you import a video without naming it AviSynth assigns it the name "last". If you use a filter that requires a video segment but don't explicitly specify which video to use it wil use last. So

    Code:
    Mpeg2Source("video.m2v")
    Crop(8,0,-8,-0)
    #(implied return of last)
    is the same as saying

    Code:
    last=Mpeg2Source("video.m2v")
    last=Crop(last,8,0,-8,-0)
    return(last)
    Quote Quote  
  24. Member
    Join Date
    Oct 2009
    Location
    Portugal
    Search Comp PM
    Originally Posted by manono
    Originally Posted by rippergreat
    is it possible to do like timing comes on certain time then goes off
    Probably with the use of the SelectRangeEvery command. You could fade it in and out as well:

    http://avisynth.org/mediawiki/SelectRangeEvery
    http://avisynth.org/mediawiki/Fade

    If you can't figure out how to use them yourself, give us your current script, how often you want the logo to appear and how long you want it to stay on. And if you want it faded, how much time for the fade in/out? The framerate of the video would also be helpful.
    Can you help me, please. I want to fade in/out my videos every minute. My script is all this:
    AVISource("D:\2009-05-31_17.27.38.avi", audio=false)
    myoverlay=ImageSource("D:\cef\images_cef\logo.png" )
    Overlay(myoverlay, 0, 400, opacity=0.2)

    Thank you
    Quote Quote  
  25. You're not being specific enough. How long is the logo to be on screen each time? How long is the FadeIn/Out to last? How long between logo 'appearances'?

    Get stickboy's ApplyEvery plugin for AviSynth here:

    http://avisynth.org/stickboy/

    Convert everything to RGB32 and try some variation of this script:

    LoadPlugin("C:\Path\To\ApplyEvery.dll")
    A=AVISource("D:\2009-05-31_17.27.38.avi", audio=false)
    B=ImageSource("D:\cef\images_cef\logo.png",End=249 ) #logo onscreen for 10 seconds at 25fps
    A=A.ConvertToRGB32(Matrix="PC.601")
    B=B.ConvertToRGB32(Matrix="PC.601")
    B=B.FadeIO0(25) #fading in and out for 1 second each at 25fps
    ApplyEvery(A,1500,"Layer(B,X=0,Y=40,Level=128)") #logo applied every 1500 frames (every minute at 25fps), adjust level for how strong you want the logo at max. 257 is default and full strength.
    ConvertToYV12(Matrix="PC.601") #or whatever colorspace you need for the output

    http://avisynth.org/mediawiki/Layer
    Quote Quote  
  26. Member
    Join Date
    Oct 2009
    Location
    Portugal
    Search Comp PM
    Originally Posted by manono
    You're not being specific enough. How long is the logo to be on screen each time? How long is the FadeIn/Out to last? How long between logo 'appearances'?

    Get stickboy's ApplyEvery plugin for AviSynth here:

    http://avisynth.org/stickboy/

    Convert everything to RGB32 and try some variation of this script:

    LoadPlugin("C:\Path\To\ApplyEvery.dll")
    A=AVISource("D:\2009-05-31_17.27.38.avi", audio=false)
    B=ImageSource("D:\cef\images_cef\logo.png",End=249 ) #logo onscreen for 10 seconds at 25fps
    A=A.ConvertToRGB32(Matrix="PC.601")
    B=B.ConvertToRGB32(Matrix="PC.601")
    B=B.FadeIO0(25) #fading in and out for 1 second each at 25fps
    ApplyEvery(A,1500,"Layer(B,X=0,Y=40,Level=128)") #logo applied every 1500 frames (every minute at 25fps), adjust level for how strong you want the logo at max. 257 is default and full strength.
    ConvertToYV12(Matrix="PC.601") #or whatever colorspace you need for the output

    http://avisynth.org/mediawiki/Layer
    Thank you. Do you know if there is a way of avoiding all those color conversions?
    Quote Quote  
  27. Originally Posted by madeinlisboa
    Thank you. Do you know if there is a way of avoiding all those color conversions?
    Everything has to be in RGB32 for it to work correctly in the first place - the colorspaces have to be the same. The AVI is YV12 and a PNG I made for testing was RGB24. If yours is RGB32, then it doesn't have to be converted, of course. Then, since RGB32 isn't any good for anything (except for TMPGEnc?), it has to be converted back to whatever your encoder needs. If you're making another AVI, that means YV12. If encoding in VDub, I guess you can leave it in RGB32, and let it convert it back to YV12, but I prefer to do the conversion myself in the script. So, to answer your question, I know of no way to avoid the color conversions. But I'm no expert on that particular subject. I was just happy to get a working script that does what you asked.
    Quote Quote  
  28. Member
    Join Date
    Oct 2009
    Location
    Portugal
    Search Comp PM
    I appreciate your help. Thank you again. I asked that because in the future I'm going to convert files from HD digital video cameras to mp4 (x264), and I'm afraid that it will take ages to encode them if color conversion is applied.
    Shall I keep using the same color spaces on those kind of files?
    Again, thank you for the time you spared.
    Quote Quote  
  29. I decided to use Layer instead of Overlay, because it worked - when not being used, the logo was invisible. When using Overlay I kept getting a big black square when there shouldn't have been anything. I was probably doing something wrong, though. I think x264 also uses YV12, so you'll still need colorspace conversions. There's just no way around it when putting RGB pics onto YV12 video. As I said earlier in this thread, I don't approve of watermarks anyway. If you're so worried about the slower encoding, don't use them.

    If you're about to switch to encoding to x264 using Hi-Def sources, the slowdown caused by the colorspace conversions is the least of your worries. Much more of the slower encoding will be caused by using those Hi-Def sources. The best thing you can do is to buy yourself a nice new i7 CPU.
    Quote Quote  
  30. Member
    Join Date
    Oct 2009
    Location
    Portugal
    Search Comp PM
    I need the watermarks. They are required to personalize/copyright some eLearning videos I'm about to convert for a friend.

    Anyway, you've been a great help!
    Quote Quote  



Similar Threads

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