VideoHelp Forum
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. Member
    Join Date
    Feb 2018
    Location
    europe
    Search PM
    hello,

    I'm working on a video , for personnal use only, and the vide has some burnt subtitles. So I decided to use the Skier's AVS script from https://forum.videohelp.com/threads/358181-How-to-remove-hard-coded-subtitles-HELP-PLE...SE#post2481785

    For that script, it works perfectly, The result is quite good. Look at this my script for harcoded subtitles :
    LoadVirtualdubplugin("C:\Users\**\Desktop\Nouveau dossier (2)\plugins32\exorcist.vdf", "Exorcist", 1)
    LoadVirtualdubplugin("C:\Users\**\Desktop\Nouveau dossier (2)\plugins32\Bright.vdf", "Brightness_Contrast", 1)
    SubtitleTopLeftX = 298
    SubtitleTopLeftY = 790
    SubtitleTopRightX =1620
    SubtitleTopRightY = 790
    clip = DirectShowSource("F:\****.mkv").ConvertToRGB32()
    maskclip = Levels(clip, 113, 10.000, 255, 75, 210)
    maskclip = GeneralConvolution(maskclip, 0, "
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10 ", 256, false)
    clip2 = OverLay(clip,maskclip,0,0,mode="subtract")
    clip2 = Blur(clip2, 1.58)
    clip2 = ConvertToYUY2(clip2)
    clip2= Tweak(clip2, hue=25.7,bright=32,cont=7.0)
    maskclip = Crop(clip2, SubtitleTopLeftX,SubtitleTopLeftY,-SubtitleTopLeftX,80).ConvertToRGB32.crop(0,0,0,-2).Trim(0,0)
    maskclip = maskclip.Brightness_Contrast(-254, 32)
    maskclip = ConvertToYUY2(maskclip)
    maskclip = Tweak(maskclip, hue=-180.0,sat=0.0,bright=22,cont=10.0)
    maskclip = ConvertToRGB32(maskclip)
    maskclip = maskclip.Levels(0, 0.281, 100, 6, 177)
    maskclip = maskclip.Greyscale()
    maskclip = maskclip.Exorcist(2, 100)
    maskclip = maskclip.Exorcist(-2, 100)
    maskclip = maskclip.Brightness_Contrast(-21, 32)
    maskclip = GeneralConvolution(maskclip, 0, "
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25 ", 256, false)
    maskclip = maskclip.Core(116,0)
    maskclip = maskclip.Blur(1.58)
    clip = dekafka(clip, maskclip, SubtitleTopLeftX, SubtitleTopLeftY, maskclip.width, maskclip.height,216)
    clip = ConvertToYV12(clip)
    return clip


    Then I want to insert an image, at X frame of the video. so my script for this is :
    DirectShowSource("F:\***.mkv").ConvertToRGB32()
    logo = ImageSource("C:\Users\***\Desktop\test2.png").Conv ertToRGB32()
    logooverlay = Overlay(logo, x=0, y= 0, mode="blend")
    Trim(0,4312) ++ logooverlay.Trim(4313,4424) ++ Trim(4425,150626)
    on these 4 lines, my script works perfectly


    But when I decide to put it on my previous long script (the harcoded subtitles script), the script for adding image seems to not working. I dont have avisynt error, but the image don't appear on the screen

    Could someone have some idea please ? Why I can't "join" 2 scripts like this ?
    Is it possible ? if yes, how ?

    thanks a lot.
    Quote Quote  
  2. The Return line at the end of the first script is the end of it. Anything following it would be ignored.

    From near the end of your first script, try something like this. I'm assuming both scripts refer to the same DirectShowSource video? If so, it's probably easier to keep "Clip" assigned only to the source video.

    Here, the output of the first script becomes NewClip1 and the image is overlayed on that as NewClip2, rather than overlaying it on an unprocessed version of the DirectShowSource video. I assume that's what you're wanting to do?

    maskclip = maskclip.Core(116,0)
    maskclip = maskclip.Blur(1.58)
    NewClip1 = dekafka(Clip, maskclip, SubtitleTopLeftX, SubtitleTopLeftY, maskclip.width, maskclip.height,216)

    # skip the ConvertToYV12 and Return lines at the end of the first script
    # skip the DirectShowSource line at the beginning of the second script.

    Logo = ImageSource("C:\Users\***\Desktop\test2.png")
    NewClip2 = Overlay(NewClip1, Logo, x=0, y= 0, mode="blend")

    # Change NewClip1 to Clip in the line above, if you want to overlay the image on an unprocessed version of the source video.

    NewClip1.Trim(0,4312) ++ NewClip2.Trim(4313,4424) ++ NewClip1.Trim(4425,150626)
    ConvertToYV12()
    Last edited by hello_hello; 14th Oct 2018 at 02:59.
    Quote Quote  
  3. Member
    Join Date
    Feb 2018
    Location
    europe
    Search PM
    hello
    thanks for answers, so now it works perfectly

    however, I need some other help, always in this script.

    I would if possible to blur hardcoded subtitles only between frame number 4740 and frame number 132834.

    I tried to put

    .Trim(4740, 132834)

    after this line

    clip2 = OverLay(clip,maskclip,0,0,mode="subtract")

    but it doesn't work : the mask seems to be "copied" only between 4740 and 132834 frames

    how could I just blur my hardocded subtitles only between 4740 and 132834 frames ? where do I must put my Trim script ?

    thanks so much
    Quote Quote  
  4. Remember the original clip then use ReplaceFramesSimple(original, nosubs, mappings="[4740 132834]").
    Quote Quote  
  5. Member
    Join Date
    Feb 2018
    Location
    europe
    Search PM
    hello, thanks
    I've tried, even with replacing original and deleting nosubs, but, I've got some error for this line


    in the avisynth wiki they said
    ReplaceFramesSimple(baseClip, sourceClip, mappings="[10 20] 25 30")

    in my first clip (of first message here) what are my baseClip and my sourceClip ?


    In fact, now, my entire script is for the full length of my video. I don't want to remap or replace frame, I just want my script ONLY between 4340 and 132834 frames, not the full video

    do you see what I mean ?
    Last edited by sulkiyan; 14th Oct 2018 at 08:20.
    Quote Quote  
  6. RemapFramesSimple replaces frames in the first clip with the specified frames from the second clip.
    Last edited by jagabo; 14th Oct 2018 at 09:09.
    Quote Quote  
  7. Member
    Join Date
    Feb 2018
    Location
    europe
    Search PM
    I understand what RemapFramesSimple do, but I've got only ONE video, not two.

    And when I try your script, all my entire script for removing hardcoded subtitless is "cancelled" : I see again all hardcoded subtitles

    do you help me with the good syntax please ?
    Quote Quote  
  8. Originally Posted by sulkiyan View Post
    I understand what RemapFramesSimple do, but I've got only ONE video, not two.
    Did you read my first post?
    Originally Posted by jagabo View Post
    Remember the original clip
    Then you'll have two clips for ReplaceFramesSimple().
    Quote Quote  
  9. Member
    Join Date
    Feb 2018
    Location
    europe
    Search PM
    yes I saw it

    this is what i added at the end of my entire script

    clip = DirectShowSource("F:\***.mkv").ConvertToRGB32()
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\RemapFrames.dll")
    ReplaceFramesSimple(clip, maskclip, mappings="[4740 132834]")

    I tried all possible things for replaceframessimple (sourceclip and baseclip), and at each time, it's not working
    Quote Quote  
  10. sourcelclip and baseclip are symbolic names in the examples. Replace them with the names of the clips in your script.

    I don't have some of the filters you're using, or a suitable test clip, so I can't test this -- but I think it will work:

    Code:
    LoadVirtualdubplugin("C:\Users\**\Desktop\Nouveau dossier (2)\plugins32\exorcist.vdf", "Exorcist", 1)
    LoadVirtualdubplugin("C:\Users\**\Desktop\Nouveau dossier (2)\plugins32\Bright.vdf", "Brightness_Contrast", 1)
    SubtitleTopLeftX = 298
    SubtitleTopLeftY = 790
    SubtitleTopRightX =1620
    SubtitleTopRightY = 790
    original = DirectShowSource("F:\****.mkv")
    clip = ConvertToRGB32(original)
    maskclip = Levels(clip, 113, 10.000, 255, 75, 210)
    maskclip = GeneralConvolution(maskclip, 0, "
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10 ", 256, false)
    clip2 = OverLay(clip,maskclip,0,0,mode="subtract")
    clip2 = Blur(clip2, 1.58)
    clip2 = ConvertToYUY2(clip2)
    clip2= Tweak(clip2, hue=25.7,bright=32,cont=7.0)
    maskclip = Crop(clip2, SubtitleTopLeftX,SubtitleTopLeftY,-SubtitleTopLeftX,80).ConvertToRGB32.crop(0,0,0,-2).Trim(0,0)
    maskclip = maskclip.Brightness_Contrast(-254, 32)
    maskclip = ConvertToYUY2(maskclip)
    maskclip = Tweak(maskclip, hue=-180.0,sat=0.0,bright=22,cont=10.0)
    maskclip = ConvertToRGB32(maskclip)
    maskclip = maskclip.Levels(0, 0.281, 100, 6, 177)
    maskclip = maskclip.Greyscale()
    maskclip = maskclip.Exorcist(2, 100)
    maskclip = maskclip.Exorcist(-2, 100)
    maskclip = maskclip.Brightness_Contrast(-21, 32)
    maskclip = GeneralConvolution(maskclip, 0, "
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25 ", 256, false)
    maskclip = maskclip.Core(116,0)
    maskclip = maskclip.Blur(1.58)
    clip = dekafka(clip, maskclip, SubtitleTopLeftX, SubtitleTopLeftY, maskclip.width, maskclip.height,216)
    clip = ConvertToYV12(clip)
    # at this point "original" is the original video, "clip" is the video with subs removed
    ReplaceFramesSimple(original, clip, mappings="[4740 132834]")
    
    logo = ImageSource("C:\Users\***\Desktop\test2.png").ConvertToRGB32()
    logooverlay = Overlay(logo, x=0, y= 0, mode="blend")
    Trim(0,4312) ++ logooverlay.Trim(4313,4424) ++ Trim(4425,150626)
    You shouldn't use DirectshowSource(). It's not frame accurate. Use a frame accurate source filter like LSMASH or ffms2.
    Last edited by jagabo; 14th Oct 2018 at 10:23.
    Quote Quote  
  11. Member
    Join Date
    Feb 2018
    Location
    europe
    Search PM
    thanks, after modifications, I don't have error, but the script for removing the subs is ALWAYS applied for the ENTIRE video, not for video part between 4740 and 132834 frames.

    it's strange
    Quote Quote  
  12. I haven't used ReplaceFrames, and I'm still not 100% sure what you're wanting to do, but I assume for the script below "Clip" is the source video, "Clippy" would be a second source video if you're using one (otherwise you don't need that line), "NewClip1" is the clip with blurred subtitles, and "NewClip2" is the clip with the overlayed image. You can overlay the image on "Clip", "Clippy" or "NewClip1", whichever you specify for Overlay(), and it'll be "NewClip2".

    Code:
    LoadVirtualdubplugin("C:\Users\**\Desktop\Nouveau dossier (2)\plugins32\exorcist.vdf", "Exorcist", 1)
    LoadVirtualdubplugin("C:\Users\**\Desktop\Nouveau dossier (2)\plugins32\Bright.vdf", "Brightness_Contrast", 1)
    SubtitleTopLeftX = 298
    SubtitleTopLeftY = 790
    SubtitleTopRightX =1620
    SubtitleTopRightY = 790
    Clip = DirectShowSource("F:\****.mkv").ConvertToRGB32()
    Clippy = DirectShowSource("F:\****.mkv").ConvertToRGB32() # if the clip for overlaying the image is different to the previous one
    maskclip = Levels(clip, 113, 10.000, 255, 75, 210)
    maskclip = GeneralConvolution(maskclip, 0, "
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10 ", 256, false)
    clip2 = OverLay(clip,maskclip,0,0,mode="subtract")
    clip2 = Blur(clip2, 1.58)
    clip2 = ConvertToYUY2(clip2)
    clip2= Tweak(clip2, hue=25.7,bright=32,cont=7.0)
    maskclip = Crop(clip2, SubtitleTopLeftX,SubtitleTopLeftY,-SubtitleTopLeftX,80).ConvertToRGB32.crop(0,0,0,-2).Trim(0,0)
    maskclip = maskclip.Brightness_Contrast(-254, 32)
    maskclip = ConvertToYUY2(maskclip)
    maskclip = Tweak(maskclip, hue=-180.0,sat=0.0,bright=22,cont=10.0)
    maskclip = ConvertToRGB32(maskclip)
    maskclip = maskclip.Levels(0, 0.281, 100, 6, 177)
    maskclip = maskclip.Greyscale()
    maskclip = maskclip.Exorcist(2, 100)
    maskclip = maskclip.Exorcist(-2, 100)
    maskclip = maskclip.Brightness_Contrast(-21, 32)
    maskclip = GeneralConvolution(maskclip, 0, "
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25 ", 256, false)
    maskclip = maskclip.Core(116,0)
    maskclip = maskclip.Blur(1.58)
    NewClip1 = dekafka(Clip, maskclip, SubtitleTopLeftX, SubtitleTopLeftY, maskclip.width, maskclip.height,216)
    Logo = ImageSource("C:\Users\***\Desktop\test2.png")
    NewClip2 = Overlay(Clippy, Logo, x=0, y= 0, mode="blend") # specify Clip, Clippy or NewClip1 as the video to overlay the image, whichever you want to use.
    
    Clip.Trim(0,4312)\
    ++ NewClip2.Trim(4313,4424)\
    ++ Clip.Trim(4425, 4739)\
    ++ NewClip1.Trim(4740, 132834)
    
    ConvertToYV12()
    Then it should just be a matter of changing the trims to append the frames from the appropriate clips. This is the same as appending them on a single line, but it's easier to read.

    Clip.Trim(0,4312)\
    ++ NewClip2.Trim(4313,4424)\
    ++ Clip.Trim(4425, 4739)\
    ++ NewClip1.Trim(4740, 132834)
    ConvertToYV12()

    I can't test it either, but that should work.
    Last edited by hello_hello; 14th Oct 2018 at 12:15.
    Quote Quote  
  13. Originally Posted by sulkiyan View Post
    thanks, after modifications, I don't have error, but the script for removing the subs is ALWAYS applied for the ENTIRE video, not for video part between 4740 and 132834 frames.
    Post your entire script.
    Quote Quote  
  14. Member
    Join Date
    Feb 2018
    Location
    europe
    Search PM
    here my entire script

    LoadVirtualdubplugin("C:\Users\**\Desktop\Nouveau dossier (2)\plugins32\exorcist.vdf", "Exorcist", 1)
    LoadVirtualdubplugin("C:\Users\**\Desktop\Nouveau dossier (2)\plugins32\Bright.vdf", "Brightness_Contrast", 1)
    SubtitleTopLeftX = 298
    SubtitleTopLeftY = 790
    SubtitleTopRightX =1620
    SubtitleTopRightY = 790
    original = DirectShowSource("F:\***.mkv")
    clip = ConvertToRGB32(original)
    maskclip = Levels(clip, 113, 10.000, 255, 75, 210)
    maskclip = GeneralConvolution(maskclip, 0, "
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10 ", 256, false)
    clip2 = OverLay(clip,maskclip,0,0,mode="subtract")
    clip2 = Blur(clip2, 1.58)
    clip2 = ConvertToYUY2(clip2)
    clip2= Tweak(clip2, hue=25.7,bright=32,cont=7.0)
    maskclip = Crop(clip2, SubtitleTopLeftX,SubtitleTopLeftY,-SubtitleTopLeftX,80).ConvertToRGB32.crop(0,0,0,-2).Trim(0,0)
    maskclip = maskclip.Brightness_Contrast(-254, 32)
    maskclip = ConvertToYUY2(maskclip)
    maskclip = Tweak(maskclip, hue=-180.0,sat=0.0,bright=22,cont=10.0)
    maskclip = ConvertToRGB32(maskclip)
    maskclip = maskclip.Levels(0, 0.281, 100, 6, 177)
    maskclip = maskclip.Greyscale()
    maskclip = maskclip.Exorcist(2, 100)
    maskclip = maskclip.Exorcist(-2, 100)
    maskclip = maskclip.Brightness_Contrast(-21, 32)
    maskclip = GeneralConvolution(maskclip, 0, "
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25 ", 256, false)
    maskclip = maskclip.Core(116,0)
    maskclip = maskclip.Blur(1.58)
    clip = dekafka(clip, maskclip, SubtitleTopLeftX, SubtitleTopLeftY, maskclip.width, maskclip.height,216)
    ReplaceFramesSimple(original, clip, mappings="[4740 132834]")
    logo = ImageSource("C:\Users\**\Desktop\test2.png")
    NewClip2 = Overlay(clip, logo, x=0, y= 0, mode="blend")
    clip.Trim(0,4312) ++ NewClip2.Trim(4313,4424) ++ clip.Trim(4425,150626)
    original = DirectShowSource("F:\***.mkv")
    clip = ConvertToRGB32(original)
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\assrender.dll")
    AssRender("C:\Users\*\Desktop\A.ass")
    AssRender("C:\Users\*\Desktop\C.ass")
    AssRender("C:\Users\*\Desktop\D.ass")
    Quote Quote  
  15. Whenever you don't specify a clip by name the name "last" is used automatically. In your script ReplaceFramesSimple is creating a clip called last. Which is then ignored by the rest of the script which is using "clip" instead. Changing the line to "clip = ReplaceFramesSimple..." should take care of that problem. Then there are some useless lines near the end of the script.

    Try this:

    Code:
    LoadVirtualdubplugin("C:\Users\**\Desktop\Nouveau dossier (2)\plugins32\exorcist.vdf", "Exorcist", 1)
    LoadVirtualdubplugin("C:\Users\**\Desktop\Nouveau dossier (2)\plugins32\Bright.vdf", "Brightness_Contrast", 1)
    SubtitleTopLeftX = 298
    SubtitleTopLeftY = 790
    SubtitleTopRightX =1620
    SubtitleTopRightY = 790
    original = DirectShowSource("F:\***.mkv")
    clip = ConvertToRGB32(original)
    maskclip = Levels(clip, 113, 10.000, 255, 75, 210)
    maskclip = GeneralConvolution(maskclip, 0, "
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10
    10 10 10 10 10 ", 256, false)
    clip2 = OverLay(clip,maskclip,0,0,mode="subtract")
    clip2 = Blur(clip2, 1.58)
    clip2 = ConvertToYUY2(clip2)
    clip2= Tweak(clip2, hue=25.7,bright=32,cont=7.0)
    maskclip = Crop(clip2, SubtitleTopLeftX,SubtitleTopLeftY,-SubtitleTopLeftX,80).ConvertToRGB32.crop(0,0,0,-2).Trim(0,0)
    maskclip = maskclip.Brightness_Contrast(-254, 32)
    maskclip = ConvertToYUY2(maskclip)
    maskclip = Tweak(maskclip, hue=-180.0,sat=0.0,bright=22,cont=10.0)
    maskclip = ConvertToRGB32(maskclip)
    maskclip = maskclip.Levels(0, 0.281, 100, 6, 177)
    maskclip = maskclip.Greyscale()
    maskclip = maskclip.Exorcist(2, 100)
    maskclip = maskclip.Exorcist(-2, 100)
    maskclip = maskclip.Brightness_Contrast(-21, 32)
    maskclip = GeneralConvolution(maskclip, 0, "
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25
    25 25 25 25 25 ", 256, false)
    maskclip = maskclip.Core(116,0)
    maskclip = maskclip.Blur(1.58)
    clip = dekafka(clip, maskclip, SubtitleTopLeftX, SubtitleTopLeftY, maskclip.width, maskclip.height,216)
    clip = ReplaceFramesSimple(original, clip, mappings="[4740 132834]")
    logo = ImageSource("C:\Users\**\Desktop\test2.png")
    NewClip2 = Overlay(clip, logo, x=0, y= 0, mode="blend")
    clip.Trim(0,4312) ++ NewClip2.Trim(4313,4424) ++ clip.Trim(4425,150626)
    LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\assrender.dll")
    AssRender("C:\Users\*\Desktop\A.ass")
    AssRender("C:\Users\*\Desktop\C.ass")
    AssRender("C:\Users\*\Desktop\D.ass")
    Quote Quote  
  16. Member
    Join Date
    Feb 2018
    Location
    europe
    Search PM
    No, it won't be necessary to copy th script just above.

    I take the one on your previous post and I added ++ Clip.Trim(132935, 150626)
    (you've forgot it :P and my video was cut at 132934 frame.

    so now, everything is working perfectly
    thanks so so much for your suggestions , appreciate

    PS : before I go, I'm wondering if with some avs script I could put a logo following end credits ? OR do I make it with premiere pro ?
    If you don't know, doesn't matter,
    thanks so so much, see ya
    Quote Quote  
  17. Just create a blank clip with the same properties as your video and overlay your logo, then append it at the end.
    Quote Quote  



Similar Threads

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