Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th December 2024, 17:02   #1021  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,805
you just Trim++Trim, something like that:
Code:
source=<yoursourcefilterhere("yoursourcepathhere")>
lastlogoframe=180*Round(framerate(source))# 180 is a placeholder for seconds of logoduration
Trim(InpaintDeLogo(source),0,lastlogoframe)++Trim(source,lastlogoframe+1,0)
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 10th December 2024 at 17:04.
Emulgator is offline   Reply With Quote
Old 11th December 2024, 08:50   #1022  |  Link
buddha9
Registered User
 
buddha9's Avatar
 
Join Date: Nov 2023
Posts: 18
Quote:
Originally Posted by Emulgator View Post
you just Trim++Trim, something like that:
Code:
source=<yoursourcefilterhere("yoursourcepathhere")>
lastlogoframe=180*Round(framerate(source))# 180 is a placeholder for seconds of logoduration
Trim(InpaintDeLogo(source),0,lastlogoframe)++Trim(source,lastlogoframe+1,0)
Thansk for quick hint!

My video is 1h 30m long.
The whole video has a logo (upper left)
For the first 180 seconds there is also another logo (bottom right)

I made 2 BMP file (https://file.io/L1Wa6jqFCCuO):
- the first with 2 white logo masks
- the second only for logo on upper left

How can I write the script with InpaintDeLogo ?

Last edited by buddha9; 11th December 2024 at 08:55.
buddha9 is offline   Reply With Quote
Old 11th December 2024, 09:53   #1023  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,066
Quote:
Originally Posted by buddha9 View Post
How can I write the script with InpaintDeLogo ?
The script would look something like this:

PHP Code:
LWLibAvVideoSource("D:\video.mp4")

# Here we split video and delogo only some part. Those are frame numbers in Trim(): 
v1 v.Trim(0,50).InpaintDelogo(bottom right)
v2 v.Trim(51,0)

# Here we join all parts and delogo whole video
v1++v2
InpaintDelogo
(upper left

Last edited by VoodooFX; 11th December 2024 at 11:21.
VoodooFX is offline   Reply With Quote
Old 11th December 2024, 22:11   #1024  |  Link
buddha9
Registered User
 
buddha9's Avatar
 
Join Date: Nov 2023
Posts: 18
red pill or blue pill ? :)

PHP Code:
path="..."
pathDGD="..."
filename="...mkv"

##################################################

clipv FFmpegSource2(path+filename)
Delogoed=InpaintDelogo(clipvmask=path+"upper_left.bmp",  Loc="50,32,98,90")
StackHorizontal(clipv.converttorgb32().Zoom(srcx="100"srcy="70",factor="6").crop(100,120,500,420), Delogoed.converttorgb32().Zoom(srcx="100"srcy="70",factor="6").crop(100,120,500,420)) 


upper_left.bmp:


I'm hapy with the result!
Anyway, any hints to improve it?
Thanks!

Last edited by buddha9; 15th December 2024 at 20:44.
buddha9 is offline   Reply With Quote
Old 13th December 2024, 16:12   #1025  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,066
Quote:
Originally Posted by buddha9 View Post
I'm hapy with the result!
Anyway, any hints to improve it?
Thanks!
Looks very good I think.
VoodooFX is offline   Reply With Quote
Old 19th January 2025, 07:31   #1026  |  Link
frobber
Registered User
 
frobber's Avatar
 
Join Date: Sep 2023
Posts: 21
Hope this is the right place to post a question.

I, too, am stuck trying to use InpaintDelogo...

Using InpaintLoc() in a script, I have identified the Loc values for the mask. It works. I see a light yellow region in the video preview.

But then when I try to automatically create the mask, MeGUI fails with the error "The video stream cannot be opened". I.e., InpaintLoc() works, but InpaintDelogo() doesn't.

Here's my script:

Code:
Import("C:\Program Files (x86)\AviSynth+\plugins64\InpaintDelogo.avsi")
LoadPlugin("C:\MeGUI-2944-64\tools\lsmash\LSMASHSource.dll")
LoadPlugin("C:\MeGUI-2944-64\tools\avisynth_plugin\TIVTC.dll")
LWLibavVideoSource("C:\MyMovie 1080i HDTV MPEG-2 AAC2.0.mkv")
tfm(order=1).tdecimate()
# InpaintLoc(Loc="1144,950,70,88")
InpaintDelogo(mask="C:\Program Files (x86)\AviSynth+\plugins64\Logo Database\MyMask.1080_v1_1144-950.bmp", Loc="1144,950,70,88", Automask=1, aMix=5)
IIUC, this should create the mask file. The source is a TS file. I have converted it to MKV using mkvtoolnix, and also tried making a D2V file using DGIndex (and then opening it using MPEG2Source()), but regardless I always get the same error from MeGUI.

What am I doing wrong?
frobber is offline   Reply With Quote
Old 19th January 2025, 21:46   #1027  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,066
Quote:
Originally Posted by frobber View Post
I always get the same error from MeGUI.
Post full MeGUI's Log.
And you could cut and share a small sample of video to reproduce.

Last edited by VoodooFX; 20th January 2025 at 01:20.
VoodooFX is offline   Reply With Quote
Old 19th January 2025, 23:31   #1028  |  Link
frobber
Registered User
 
frobber's Avatar
 
Join Date: Sep 2023
Posts: 21
Thanks for your message. After restarting my PC, curiously the error changed to something different. The error was due to a missing DLL (AvsInPaint.dll).

I fixed that, but now there's another error. Evidently I'm still doing something wrong.

Here's the log and a short sample of the video:

https://www.sendspace.com/file/zodixv (3 KB)

https://www.sendspace.com/file/5egptg (36 MB)

I'm trying to set up the logo file, remove the logo, convert the video from 29.97 fps, fix the aspect ratio and remove the black bars on the sides.
frobber is offline   Reply With Quote
Old 20th January 2025, 02:14   #1029  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,066
Tested your shared script and file - no problems.

Quote:
Originally Posted by frobber View Post
After restarting my PC, curiously the error changed to something different. The error was due to a missing DLL (AvsInPaint.dll).
Did you installed all other requirements?
You could share what "AVSMeter64 -avsinfo" shows.

Code:
-[NoImage] RT_ReadTxtFromFile: Cannot Open file C:\Program Files (x86)\AviSynth+\plugins64\Logo Database\NihonEiga.1080_v1_1144-950.bmp_InpaintDelogo3_1144-950-226-42_A2-16.txt
-[NoImage] (C:\Program Files (x86)\AviSynth+\plugins64\InpaintDelogo.avsi, line 2977)
-[NoImage] (C:\Program Files (x86)\AviSynth+\plugins64\InpaintDelogo.avsi, line 2994)
-[NoImage] (C:\Program Files (x86)\AviSynth+\plugins64\InpaintDelogo.avsi, line 1885)
-[NoImage] (C:\Program Files (x86)\AviSynth+\plugins64\InpaintDelogo.avsi, line 1890)
-[NoImage] (C:\Program Files (x86)\AviSynth+\plugins64\InpaintDelogo.avsi, line 1892)
-[NoImage] (C:\Program Files (x86)\AviSynth+\plugins64\InpaintDelogo.avsi, line 1906)
-[NoImage] (C:\Users\xxx\Documents\Kinugasa-1.avs, line 9)
Log doesn't match your shared script, post the avs script matching the error.

Check if that txt file exists.
What is "NihonEiga.1080_v1_1144-950.bmp"? There is only "NihonEiga.1080_v2_1310-948.ebmp" in the current "Logo Database".

Last edited by VoodooFX; 20th January 2025 at 02:26.
VoodooFX is offline   Reply With Quote
Old 20th January 2025, 03:11   #1030  |  Link
frobber
Registered User
 
frobber's Avatar
 
Join Date: Sep 2023
Posts: 21
Thanks. I believe I have installed all the requirements (though of course maybe I flubbed something).

Here is the AviSynth Info Tool readout:

https://www.sendspace.com/file/ty4y9s

Running the AVS script took hours, so before I post that, could I confirm that I'm on the right track? Probably I need to change the script first.

As you see, there is already a logo in the database, but its position in the frame is different, and the frame in the video I've got appears horizontally squished, so I assumed that I need(?) to create a new BMP file for the logo. And that's where I'm stuck.

The TXT file is missing because I didn't create it. I don't know what it's supposed to be about.

Basically, I am unclear on the steps that I need to take.

TIA !

Last edited by frobber; 20th January 2025 at 10:34. Reason: clarification
frobber is offline   Reply With Quote
Old 20th January 2025, 11:18   #1031  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,066
Quote:
Originally Posted by frobber View Post
Running the AVS script took hours, so before I post that
You can run tests on smaller portion of video, you can limit video with Trim().

Quote:
Originally Posted by frobber View Post
As you see, there is already a logo in the database, but its position in the frame is different...
You can move it as you like by changing Loc coords and you don't need to create anything for those ebmp masks in database.

Quote:
Originally Posted by frobber View Post
The TXT file is missing because I didn't create it. I don't know what it's supposed to be about.
InpaintDelogo creates it. No idea how you get that error as you didn't shared the script. And I don't know any way how such error could be produced.


Quote:
Originally Posted by frobber View Post
Basically, I am unclear on the steps that I need to take.
Basically we are not clear what you are doing out there as you didn't described your steps.


Quote:
Originally Posted by frobber View Post
Here is the AviSynth Info Tool readout
I don't see any fatal issues
Code:
C:\Program Files (x86)\AviSynth+\plugins64\FrameSel_x64.dll  [2.20.0.0]     # latest is [2.21.0.0, 2021-07-27]
C:\Program Files (x86)\AviSynth+\plugins64\LSMASHSource.dll  [2021-04-23]   # very old
C:\Program Files (x86)\AviSynth+\plugins64\mvtools2.dll  [2.7.45.0]         # latest is [2.7.46.0, 2024-05-03]
C:\Program Files (x86)\AviSynth+\plugins64\RT_Stats_x64.dll  [2.0.12.0]     # latest is [2.0.13.0, 2020-12-29]
C:\Program Files (x86)\AviSynth+\plugins64\TIVTC.dll  [1.0.26.0]            # latest is [1.0.29.0, 2024-03-02]
This one missing (not needed by default):
Code:
C:\Program Files (x86)\AviSynth+\plugins64+\AddGrainC.dll  [1.8.4.0, 2022-02-15]

Last edited by VoodooFX; 20th January 2025 at 11:34.
VoodooFX is offline   Reply With Quote
Old 20th January 2025, 16:24   #1032  |  Link
frobber
Registered User
 
frobber's Avatar
 
Join Date: Sep 2023
Posts: 21
OK, here's the script and log file:

https://www.sendspace.com/file/dz2j4c

I tried updating the old DLLs and adding the missing AddGrainC.dll, but I still get the same error.

What should I try next?

Last edited by frobber; 21st January 2025 at 01:24.
frobber is offline   Reply With Quote
Old 21st January 2025, 01:40   #1033  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,066
Quote:
Import("C:\Program Files (x86)\AviSynth+\plugins64\InpaintDelogo.avsi")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins64\LSMASHSource.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins64\TIVTC.dll")
You don't need to import/load them, plugins are autoloaded from this folder.

Quote:
InpaintDelogo(mask="C:\Program Files (x86)\AviSynth+\plugins64\Logo Database\NihonEiga.1080_v2_1310-948.bmp", Loc="1144,950,70,88", Automask=1, aMix=5)
Why this bmp named like that?

Quote:
Originally Posted by frobber View Post
OK, here's the script and log file:

https://www.sendspace.com/file/dz2j4c

I tried updating the old DLLs and adding the missing AddGrainC.dll, but I still get the same error.

What should I try next?
Maybe there is no permission to write to that folder, use your own non-Windows folder, like "D:\Myfolder".
VoodooFX is offline   Reply With Quote
Old 21st January 2025, 02:44   #1034  |  Link
frobber
Registered User
 
frobber's Avatar
 
Join Date: Sep 2023
Posts: 21
Thanks -- write access must have been the issue. I moved the Logo Database folder and now I don't see an error.

So, I am trying to create a mask, like this:

Code:
InpaintDelogo(mask="C:\Users\Me\Documents\Logo Database\NihonEiga.1080_v2_1144-948.bmp", Loc="1144,948,70,88", Automask=1, Analyze=2)
I get a video window with two images of the mask, one bitmap and one greyscale, above and below.

However, the mask just looks sort of blurry - not much like the logo.

I have tried adding the aMix parameter, with values ranging from -50 to 6, but it doesn't seem to make much difference.

How should I proceed?

Last edited by frobber; 21st January 2025 at 03:17.
frobber is offline   Reply With Quote
Old 21st January 2025, 03:27   #1035  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,066
Quote:
Originally Posted by frobber View Post
Thanks -- write access must have been the issue. I moved the Logo Database folder and now I don't see an error.
But I only get a video window with two images of the mask, one bitmap and one greyscale, above and below.
How should I proceed?
Remove Trim() from your script, delete the files created, and now run it again.
After the basemask is generated you can adjust it with aMix, then remove Automask=1 from your script and add Mode="Deblend", run the script again, on the first run the deblend masks will be generated. That's it.

Quote:
Originally Posted by frobber View Post

I read the "basic short guide" at the beginning of this thread, but maybe it's out of date. Nothing is clear in that text, really.
No, it' not out of date, the first:
PHP Code:
0Read help/manual (at the top of the scriptabout parameters mentioned 
Did you read about parameters mentioned? Specify what is not clear in the manual!
VoodooFX is offline   Reply With Quote
Old 21st January 2025, 03:49   #1036  |  Link
frobber
Registered User
 
frobber's Avatar
 
Join Date: Sep 2023
Posts: 21
OK. It's computing the new mask. I assume this will take a long while.

Re: documentation, I would say this text is not really a "manual" but more just some general code comments and usage notes. If you like, I could give more specific feedback, though it would probably be best after I manage to get this script working and remove a logo.
frobber is offline   Reply With Quote
Old 21st January 2025, 04:59   #1037  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,066
Quote:
Originally Posted by frobber View Post
OK. It's computing the new mask. I assume this will take a long while.
Depends from your CPU speed. Can take ~hour on slow CPUs.

Quote:
Originally Posted by frobber View Post
Re: documentation, I would say this text is not really a "manual" but more just some general code comments and usage notes. If you like, I could give more specific feedback, though it would probably be best after I manage to get this script working and remove a logo.
Dunno what you are smoking out there but it's not "some general code comments" like you imagine.


Now I tried "NihonEiga.1080_v2" mask from Logo Database on your test sample, it fits very well.

Original (zoomed 4 times):



You already aligned Loc well in your script (Loc="1144,950,70,88"):



From the image above hard to tell what is what, so disable the postprocessing with dPP=0, Interp=0:



Now we can see more clearly, it needs one pixel shift to the right, ShiftMasksHo=-1:



Perfect, logo gone, above we see pure deblend output without postprocess.
Artifacts are minimal so we use a bit lighter postprocess, leave Interp=0 in the script and remove dPP as its default is OK:



As source is bit grainy then we add some grain to the postprocessed area with GrainPP=2:



Here is full command ready to delogo your video:

InpaintDelogo(mask=D:\NihonEiga.1080_v2_1310-948.ebmp, Loc="1144,948,0,0", Interp=0, ShiftMasksHo=-1, GrainPP=2, Greyscale=1)
VoodooFX is offline   Reply With Quote
Old 21st January 2025, 05:09   #1038  |  Link
frobber
Registered User
 
frobber's Avatar
 
Join Date: Sep 2023
Posts: 21
That works great, thanks !
frobber is offline   Reply With Quote
Reply

Tags
delogo, hardsubs, ocr, remove, watermark

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:54.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.