VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 47
Thread
  1. Wanting to remove logos and/or text from some videos. The resulting processed videos should ideally have no artefacts whatsoever left over from where the logos/texts were. So that there is absolutely no indication that there were logos/texts within the videos to begin with.

    Enclosed is a test video. The task is to remove the BBC logo from the clip completely. For the videos I have, the logos/texts are in a fixed position on top of moving background similar to this test video clip.

    I have tried a couple of (paid) programs to remove the logo from the test clip, but the results were not too good with some blurring and/or smearing appearing where the logo was.

    How to completely remove the logo from the test video clip, please?

    https://u.pcloud.link/publink/show?code=XZXVvGVZ4ADkXNGUCzXL5Hnn7c1hVQJuz6ak
    Quote Quote  
  2. In general, you can't perfectly remove an opaque logo because there's no way of knowing exactly what was behind it. But with this particular video I took advantage of the fact that the area just below the logo is pretty much the same as the area covered by the logo. I just copied that area over the logo.
    Image Attached Files
    Quote Quote  
  3. Some of the delogo filters are pretty good, but you will never get even close to perfect removal, for the reasons jagabo stated. This is especially true if there is a lot of movement and also if there is a lot of "structure" in the image surrounding the logo. For instance, imagine panning across a half-filled stadium with people wearing different colors, with empty seats between many of them. There is no way to know what should be put into the logo area because there is no way, as jagabo said, to know what comes next.

    However, when you have a relatively static background, and there is not a lot of movement, like some stage shots, the removal can indeed be near-perfect.
    Quote Quote  
  4. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by meeshu View Post
    So that there is absolutely no indication that there were logos/texts within the videos to begin with.
    Possible only with the transparent logos and good source, sometimes opaque logos can be removed without a trace too but conditions must be right, like a logo must be in non-detailed area or when background is static.

    Originally Posted by meeshu View Post
    I have tried a couple of (paid) programs to remove the logo from the test clip, but the results were not too good
    If you want same "paid" effect for free - use DoomDelogo.

    If "paid" effect is not good then use InpaintDelogo:
    Image Attached Files
    Quote Quote  
  5. Many thanks for the constructive comments!

    Yes, I thought the removal of the test logo might be difficult due to changing imagery beneath the logo.

    I was aware that it may be possible to to sample "clean" areas of the video that are similar to or the same in appearance to the area beneath the logo, so that the sample can be used to fill or cover the logo. Unfortunately, for most of my other videos, this procedure probably will not work owing to almost constant changing/moving imagery beneath the logos/texts, so it would be impossible to sample clean areas to use as fills.

    Another possibility is to crop videos so that the logos/texts are removed. Again, unfortunately, this is not an option due to most of my other videos having foreground imagery taking up most of the frame. By cropping these videos, it would mean the loss of (important) imagery. So cropping is not really an option.

    I'll have a look at the VirtualDub/AviSynth logo removal scripts when I have the time to reinstall of the associated programs and associated scripts.
    Quote Quote  
  6. OK. I have installed VirtualDub2 and AviSynth+, as well as all of the required plugins and scripts for running InPaintDeLogo.

    Now, I'm still a beginner, so I have very little idea of what script to create to actually run InPaintDeLogo?

    Script starting by changing colorspace?
    Then load video clip to be processed?
    Then load any plugins/scripts?
    Then load parameters/settings for the any or all of the plugins?
    Anything else that has to be entered into the script?

    Can anyone please provide a sample script for running the InPaintDeLogo script/plugin and for running the required plugins/scripts as well (if necessary)?

    Thank you.
    Quote Quote  
  7. I don't use InPaintDelogo but here's a simple infill function that uses only the filters built in to AviSynth+:

    Code:
    ##########################################################################
    #
    #  Infill a rectagular block
    #
    #  x,y: coordinates of top left corner of block
    #  w,h: width and height of the block
    #  o: the opacity of the overlay (normally 1.0, 100 percent)
    #
    ##########################################################################
    
    function InFillBlock(clip v, int x, int y, int w, int h, float "opacity")
    {
        opacity = default(opacity, 1.0)
    
        v24 = ConvertToYV24(v) # allow for odd values
    
        # interpolate pixels across the height of the block
        top = v24.Crop(x, y-1, w, 1)
        bot = v24.Crop(x, y+h, w, 1)
        ypatch = StackVertical(top,bot).BilinearResize(w, h)
    
        # interpolate pixels across the width of the block
        left = v24.Crop(x-1, y, 1, h)
        right = v24.Crop(x+w, y, 1, h)
        xpatch = StackHorizontal(left, right).BilinearResize(w, h)
    
        # overlay the "least" interpolated block 
        Overlay(v, w > h  ? ypatch : xpatch, x=x, y=y, opacity=opacity)
    }
    
    ##########################################################################
    
    
    LWLibavVideoSource("Test_Video_2.mp4") 
    InFillBlock(30, 30, 150, 50) # BBC
    InFillBlock(1416, 34, 464, 44) # Antiques Roadshow (1999)
    Oh, you need the LSMASHSource filter to open the mp4 video. But you may use whatever filter works for a particular source.

    The first part of the script creates a filter called InFillBlock(). The second part of the script opens the source video and uses InFillBlock() to erase the logos. It's not as "clean" as InPaintDeLogo(). Sample attached.
    Image Attached Files
    Last edited by jagabo; 28th Sep 2023 at 11:34. Reason: added sample video
    Quote Quote  
  8. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by meeshu View Post
    Can anyone please provide a sample script for running the InPaintDeLogo script
    Code:
    LWLibAvVideoSource("D:\video.mkv")
    InpaintDelogo(mask="D:\mask.bmp", Loc="88,860,-870,-56")
    Quote Quote  
  9. Thanks for the scripts!

    I'll look into thïs shortly.

    EDIT: How do you determine the (pixel) "coordinates" of masks (or whatever else) to place where the logos and texts to be removed are?
    Last edited by meeshu; 29th Sep 2023 at 05:26. Reason: How to find coordinates/location of masks(?)
    Quote Quote  
  10. I've gotten pretty good at just estimating the location and using a Crop() to see. Then I fine tune to get the exact area I need. But you can use a visual tool like the crop feature in VirtualDub+.
    Quote Quote  
  11. Originally Posted by jagabo View Post
    I've gotten pretty good at just estimating the location and using a Crop() to see. Then I fine tune to get the exact area I need. But you can use a visual tool like the crop feature in VirtualDub+.
    Thank you!
    Quote Quote  
  12. Another question.

    What is this "mask.bmp" ? Is this something that you have to create first before running the script? If so, how to create this mask this please?

    Image
    [Attachment 74098 - Click to enlarge]
    Quote Quote  
  13. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by meeshu View Post
    Another question.

    What is this "mask.bmp" ? Is this something that you have to create first before running the script? If so, how to create this mask this please?
    You can create masks with any image editor.

    Or you can try Automask arg: InpaintDelogo(mask="D:\mask.bmp", Automask=1, Loc="88,860,-870,-56")
    Quote Quote  
  14. Originally Posted by VoodooFX View Post
    Originally Posted by meeshu View Post
    Another question.

    What is this "mask.bmp" ? Is this something that you have to create first before running the script? If so, how to create this mask this please?
    You can create masks with any image editor.

    Or you can try Automask arg: InpaintDelogo(mask="D:\mask.bmp", Automask=1, Loc="88,860,-870,-56")
    Thank you.

    If creating masks manually, what are the specific requirements? Line color? Line width? Line style? Background(fill) color etc?
    Quote Quote  
  15. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by meeshu View Post
    If creating masks manually, what are the specific requirements? Line color? Line width? Line style? Background(fill) color etc?
    Logo should be full white, the rest not full white.
    Quote Quote  
  16. Originally Posted by VoodooFX View Post
    Originally Posted by meeshu View Post
    If creating masks manually, what are the specific requirements? Line color? Line width? Line style? Background(fill) color etc?
    Logo should be full white, the rest not full white.
    Thank you!
    Quote Quote  
  17. Temporal inpainting can be beneficial in situations where the missing data (the area/objects obscured by the logo / or objects you want to remove) is contained in other frames.

    If there is no camera movement, and no BG object motion - then it's actually worse - because you never "see" the textures/objects "behind" the logo in nearby frames - then it becomes more like spatial inpainting using single frames, and you cannot benefit from the additional data contained in other frames.

    Modern machine learning temporal inpainting algorithms attempt to track objects and correct for depth, perspective, parallax and use optical flow or similar techniques to make an educated "guess" about the object motions using the data from other frames. They compensate and adjust/distort the repair to match the current frame - it's not just copy/paste from other frames and "2D" PSR (position, scaling, rotation) anymore - warped 3D corrections can be involved

    Temporal inpainting algorithms are far from perfect, and if you have lots of missing source data (not found in other frames) - they have to completely guess too. But they can be useful for some sources, and complement some workflows (you can improve and refine the results with other tools before using preprocessing and after using postprocessing)

    They tend to be difficult to use (no GUI's all python based), and generally require lots of GPU memory for ideal results (more reference frames , iterations, higher precision), but some "AI" removal tools are trickling into consumer ware now - you should see many in the near future

    The newest one is probably currently the best overall, and has the most options - ProPainter. The BasicVSR++ author is one of the co-authors.

    These use publicly available, generically trained inpainting models. You should be able to improve results if you train your own models on similar source material

    https://github.com/sczhou/ProPainter
    https://github.com/MCG-NKU/E2FGVI
    https://github.com/nbei/Deep-Flow-Guided-Video-Inpainting
    https://github.com/hitachinsk/FGT
    https://github.com/seoungwugoh/opn-demo

    Test_Video_2_ProPainter.mp4 is not processed except for cropping to the region of interest, the BBC logo, and the Antiques Roadshow (1999) logo . Cropping to reduce the memory consumption. There is some noise where there wasn't valid data (camera didn't move enough) , and around the logo mask area in the source from compression artifacts - you could probably clean it up a bit pre and/or post.
    Image Attached Files
    Quote Quote  
  18. The ProPainter results are impressive.
    Quote Quote  
  19. Originally Posted by VoodooFX View Post
    Originally Posted by meeshu View Post
    If creating masks manually, what are the specific requirements? Line color? Line width? Line style? Background(fill) color etc?
    Logo should be full white, the rest not full white.
    Is the mask a rectangular shape? If so, what is it's dimensions please?

    EDIT: what is the reference point for locating pixels? Is the (0,0) reference point at the bottom left of a frame? Or is the reference point at the Top left of a frame?
    Quote Quote  
  20. Originally Posted by jagabo View Post
    The ProPainter results are impressive.
    Yes, the ProPainter results are excellent! This ProPainter option is something I'll look at later on.
    Quote Quote  
  21. In AviSynth 0,0 is the top left corner. X increases to the right of the screen. Y increases toward the bottom of the screen.
    Quote Quote  
  22. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by meeshu View Post
    Is the mask a rectangular shape?
    No, it should be exact shape of a logo.
    Quote Quote  
  23. Comments noted, thank you!
    Quote Quote  
  24. Running test scripts for removing the logo and text from the test video clip.

    Problem is that Virtualdub seems to show the only the output video within both the input and output panes. The input video is not being displayed within the input pane (on the left).

    Both input and output panes had already been enabled within Virtualdub.

    Why isn't the input (unprocessed) video not being shown within the input pane?

    Screenshot shows output (processed) video within both panes.

    Image
    [Attachment 74144 - Click to enlarge]
    Quote Quote  
  25. Video Damager VoodooFX's Avatar
    Join Date
    Oct 2021
    Location
    At Doom9
    Search PM
    Originally Posted by meeshu View Post
    Why isn't the input (unprocessed) video not being shown within the input pane?
    Because input is output of AviSynth.
    Quote Quote  
  26. OK.

    Then is it at all possible to get the input unprocessed video to display within the input pane while the processed output video is displayed within the output pane?
    Quote Quote  
  27. Member
    Join Date
    Dec 2005
    Location
    Finland
    Search Comp PM
    The output pane is just for further VirtualDub filtering. However, you can use StackHorizontal() (or StackVertical()) within AviSynth to get both the original and processed video in the same frame for comparison purposes.
    Quote Quote  
  28. Thank you!

    After experimenting with trial and error, I got both input and output clips being displayed simultaneously using this script -

    Code:
    ##########################################################################
    #
    #  Infill a rectagular block
    #
    #  x,y: coordinates of top left corner of block
    #  w,h: width and height of the block
    #  o: the opacity of the overlay (normally 1.0, 100 percent)
    #
    ##########################################################################
    
    function InFillBlock(clip v, int x, int y, int w, int h, float "opacity")
    {
        opacity = default(opacity, 1.0)
    
        v24 = ConvertToYV24(v) # allow for odd values
    
        # interpolate pixels across the height of the block
        top = v24.Crop(x, y-1, w, 1)
        bot = v24.Crop(x, y+h, w, 1)
        ypatch = StackVertical(top,bot).BilinearResize(w, h)
    
        # interpolate pixels across the width of the block
        left = v24.Crop(x-1, y, 1, h)
        right = v24.Crop(x+w, y, 1, h)
        xpatch = StackHorizontal(left, right).BilinearResize(w, h)
    
        # overlay the "least" interpolated block 
        Overlay(v, w > h  ? ypatch : xpatch, x=x, y=y, opacity=opacity)
    }
    
    ##########################################################################
    
    LWLibavVideoSource("G:Test_Video_2.mp4")
    A=last
    
    InFillBlock(30, 30, 150, 50) # BBC
    InFillBlock(1416, 34, 464, 44) # Antiques Roadshow (1999)
    B=last
    
    StackHorizontal(A, B)
    Quote Quote  
  29. Sometimes it's helpful to see two videos interleaved frame by frame rather than stacked, eg, replace your StackHorizontal(A, B) with Interleave(A, B). With that you can flip back and forth between the same frame of the two videos using the right and left arrow keys in VirtualDub. You will be able to see minute difference between two videos. Especially if you combine it with a screen magnifier.
    Quote Quote  
  30. Originally Posted by jagabo View Post
    Sometimes it's helpful to see two videos interleaved frame by frame rather than stacked, eg, replace your StackHorizontal(A, B) with Interleave(A, B). With that you can flip back and forth between the same frame of the two videos using the right and left arrow keys in VirtualDub. You will be able to see minute difference between two videos. Especially if you combine it with a screen magnifier.
    Noted. Thank you!
    Quote Quote  



Similar Threads

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