VideoHelp Forum




+ Reply to Thread
Results 1 to 8 of 8
  1. I've started doing some DVD conversions lately, beginning with SmartRipper and feeding the video through DVD2AVI and AVISynth before hitting Helix Producer or TMPGEnc, depending on the application. Do any of these programs have the capacity to add a watermark (whether native or via a plugin), or should I start looking for a different conversion software?

    Apologies if it's in the wrong forum, and thanks in advance.
    Quote Quote  
  2. Member
    Join Date
    Feb 2001
    Location
    Berlin, Germany
    Search Comp PM
    There is no native Avisynth Logo filter for Avisynth, but you can add logos with Avisynth. You can use the logo filter of VirtualDub as described in the Avisynth 1.0x example collection.
    If you dont want to go this ancient way, you can use Avisynth 2.0x with the native Layer filter. To do this first you have to convert the image (or the imagesequence) to a videoclip. This could be done with the external plugin
    ImageSequence
    . If you need some sample scripts let me know.
    Quote Quote  
  3. Thanks for the plugin... looks like it might be what I need. Sample scripts would be great, if you have them.

    Also, can you provide clarification as to the numbering system?("file%.3d.jpg", "file%d.jpg", and the like)
    Quote Quote  
  4. Member
    Join Date
    Feb 2001
    Location
    Berlin, Germany
    Search Comp PM
    These examples were created with Avisynth 2.51. Avisynth 2.52 will probably have a native ImageReader filter.
    To demonstrate the logo overlay I have borrowed two animated gifs from http://www.gifanimations.com/
    Since ImageSequence requires 24 or 32 bit images, I have converted them to 24bit BMP image sequences.
    Video source is MPEG-2 (DVD2AVI 1.76 project) PAL 720x576.

    First you have to copy Corona.dll and imglib.dll to the system directory.

    The first example overlays the video with a simple still image.

    Code:
    # load the needed plugins
    LoadPlugin("F:\editors\Avisynth\plugins\2.5x\imagesequence\imagesequence.dll")
    LoadPlugin("F:\editors\Avisynth\plugins\2.5x\mpeg2dec\MPEG2DEC.dll")
    # open the videosource
    vid=Mpeg2Source("H:\lotr\part2.d2v").ConvertToRGB32
    # open the still image
    img=ImageSequence("H:\pumpkin\pumpkin1.bmp").ConvertToRGB32
    # mask the white background but leave the other colors unchanged
    img=ColorKeyMask(img,$FFFFFF,$000000)
    # place the image into the upper left corner of the video
    ovl=Layer(vid,img,"add",255,0,0)
    return ovl
    Here is a simple animated logo.

    Code:
    # load the needed plugins
    LoadPlugin("F:\editors\Avisynth\plugins\2.5x\imagesequence\imagesequence.dll")
    LoadPlugin("F:\editors\Avisynth\plugins\2.5x\mpeg2dec\MPEG2DEC.dll")
    # open the videosource
    vid=Mpeg2Source("H:\lotr\part2.d2v").ConvertToRGB32
    # open the imagesequence (2 images)
    img=ImageSequence("H:\pumpkin\pumpkin%d.bmp",1,2,25).ConvertToRGB32
    # mask the white background but leave the other colors unchanged
    img=ColorKeyMask(img,$FFFFFF,$000000)
    # let the images sequence loop (almost) for ever
    img=Loop(img)
    # place the image into the upper left corner of the video
    ovl=Layer(vid,img,"add",255,0,0)
    return ovl
    Well, IMHO the only reason to add a logo is to add some fancy effects to your video.
    So have a look at the following simple example.

    Code:
    # load the needed plugins
    LoadPlugin("F:\editors\Avisynth\plugins\2.5x\imagesequence\imagesequence.dll")
    LoadPlugin("F:\editors\Avisynth\plugins\2.5x\mpeg2dec\MPEG2DEC.dll")
    # open the part of the videosource where you want to add the imagesequence
    vid1=Trim((Mpeg2Source("H:\lotr\part2.d2v").ConvertToRGB32),0,199)
    # open the rest of the video
    vid2=Trim((Mpeg2Source("H:\lotr\part2.d2v").ConvertToRGB32),200,0)
    # open the imagesequence (10 images)
    img=ImageSequence("H:\baby\Baby_crawling%.4d.bmp", 1, 10, 25).ConvertToRGB32
    # mask the white background but leave the other colors unchanged
    img=ColorKeyMask(img,$FFFFFF,$000000)
    # let the images sequence loop (almost) for ever
    img=Loop(img)
    # moving anitated image (actually it is a videoclip now) over the first clip
    ovl=Animate(0,199,"Layer",vid1,img,"add",255,-150,250,vid1,img,"add",255,750,250)
    # merge both videoclips
    return ovl + vid2
    If you like, download pumpkin.bmp, baby_crawling.bmp and the ovl clip from the 3rd script here.

    Also, can you provide clarification as to the numbering system?("file%.3d.jpg", "file%d.jpg", and the like)
    If you want to load a single image, just write the real filename.
    If you want to load an image sequence the frame number must be added to the filename like image1.bmp, image2.bmp etc.
    This is the standard numbering, so write image%d.bmp.
    In the 3rd script I have used Baby_crawling0001.bmp - Baby_crawling0010.bmp, a 4 digits numbering, so the proper syntax is Baby_crawling%.4d.bmp
    Quote Quote  
  5. Okay, it makes sense, but I'm having trouble with it. Here's the script I'm using:
    Code:
    #Load the necessary plugins
    LoadPlugin("mpeg2dec.dll")
    LoadPlugin("imagesequence.dll")
    #Load variables with logo and video clips
    logo=CoronaSequence("v:\logo.bmp",1,150).ConvertToRGB32
    audio=WAVSource("source.wav")
    videoraw=MPEG2Source("source.d2v").ConvertToRGB32
    #Chop video into three sections
    video1=trim(videoraw,0,300)
    video2=trim(videoraw,301,450)
    video3=trim(videoraw,451,0)
    #Prepare logo with mask and fade
    logo=ColorKeyMask(logo,$FFFF80,$000080)
    logo=fadeio(logo,10)
    #Add logo to second part of video clip
    video2=layer(video2,logo,"add",255,640,400)
    #Reassemble video, add audio, and shrink
    video=video1+video2+video3
    audiodub(videoraw,audio)
    BicubicResize(360,240)
    Firstly, I'm forced to use "CoronaSequence", because the "ImageSequence" directive responds with a "NO PICTURES FOUND" error.

    Secondly, the audio comes in at the right time, but gets ahead of the video stream within 15 seconds. Removing the Image plugin and the logo references doesn't fix it, but removing the ".ConvertToRGB32" tag from the videoraw declaration puts things right back on track. Any ideas?
    Quote Quote  
  6. Member
    Join Date
    Feb 2001
    Location
    Berlin, Germany
    Search Comp PM
    First of all your script worked quite fine here. Of course I have replaced your source with my own ones and I have changed videoraw to video in line 19, that probably was a typo only.

    ..but removing the ".ConvertToRGB32" tag from the videoraw declaration puts things right back on track.
    This does not make sense for me. Let me try to explain.

    Line5: The logo clip must be RGB32, because ColorKeyMask requires RGB32 input.

    Line7: Mpeg2source returns a YUY2 clip if you remove ConvertToRGB32, namely videoraw.

    Line10: So video2 is a YUY2 clip too.

    Line16: Layer can overlay two clips of different sizes but with the same color format.
    Since logo is a RGB32 clip, video2 must be RGB32 as well. So either video2 or videoraw
    must be converted to RGB32 before.

    But I believe, I have found a solution.

    Your video could get out of sync due to a wrong specified framerate. ImageSequence and CoronaSequence return a 25 fps clip by default.
    Layer takes the framerate of the base clip while the audio is unchanged at that point.
    So I think, you have to set the framerate in line 5. But the filetype of fps is integer, not float.
    If your base clip is NTSC 29.97 fps and the logo shall appear only a couple of seconds, you may not notice the slight audio delay, otherwise you have to convert the logo clip to the proper framerate.

    Code:
    LoadPlugin("mpeg2dec.dll")
    LoadPlugin("imagesequence.dll")
    audio=WAVSource("source.wav")
    videoraw=MPEG2Source("source.d2v").ConvertToRGB
    logo=CoronaSequence("v:\logo.bmp",1,150,30).ConvertToRGB32
    #logo=ChangeFPS(logo,videoraw.framerate)
    video1=trim(videoraw,0,300)
    video2=trim(videoraw,301,450)
    video3=trim(videoraw,451,0)
    logo=ColorKeyMask(logo,$FFFF80,$000080)
    logo=fadeio(logo,10)
    video2=layer(video2,logo,"add",255,640,400)
    video=video1+video2+video3
    video=audiodub(video,audio)
    return BicubicResize(video,360,240)
    Quote Quote  
  7. Thanks, but I was able to figure it out on my own. First, the videoraw/video thing in line 19 was indeed a typo. I was using videoraw to test things, and forgot to change it back to video when I posted it.
    The audio sync problem was a result of my computer not being able to make the YUY2 to RGB32 conversion on the fly. The problem occurred when I viewed the AVS script directly in Windows Media Player. After running a portion of the video through TMPGEnc, the sync was fine.
    Thanks again for the help.
    Quote Quote  
  8. i need help adding watermark im totally stuck
    Quote Quote  



Similar Threads

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