Log in

View Full Version : Horizontal Lines Script or Software?


NLPguy
12th July 2023, 01:11
Hi guys, I have been using Avisynth for over 15 years.

But until today I could not create a script that works well with black horizontal lines because they are of different sizes.

Almost all the VHS tapes I have are very oxidized because where I live the normal humidity is almost 90% and it is also very hot.

In this case, do you know any program or Avisynth script that can find these horizontal lines automatically in the video so that I can do a faster and more optimized manual editing?


Thank you very much in advance

johnmeyer
12th July 2023, 01:23
Similar request over at the Videohelp forum:

AVISynth Wizards-Awful Line Interference (https://forum.videohelp.com/threads/410279-AVISynth-Wizards-Awful-Line-Interference)

VoodooFX
12th July 2023, 10:40
Share a sample of your issue.

NLPguy
13th July 2023, 01:06
Share a sample of your issue.

Some samples:


.
https://imageup.me/images/40c13fab-8a02-4fc9-aa50-44150a635166.png?v=452659
.
.
https://i.ibb.co/F40NqnZ/Fig3.png
.
.
https://i.ibb.co/hM5bVhJ/Fig2.png
.
.
https://i.ibb.co/59QW8CJ/Fig1.png

NLPguy
13th July 2023, 01:08
Similar request over at the Videohelp forum:

AVISynth Wizards-Awful Line Interference (https://forum.videohelp.com/threads/410279-AVISynth-Wizards-Awful-Line-Interference)

Share a sample of your issue.


In my case, I have a lot of 6 hours (on average) vhs tapes oxidized. And the main problem is the black horizontal lines of various sizes.

It also has thin transparent horizontal lines and white lines of various sizes.

So, if there was a way for me to scan where these errors are throughout the video, with the exact time, then I could do a much faster and more accurate manual editing. Instead of segmenting the video into each type of error and creating a script for each case.

Do you know if there is any script or program that does this?

Thanks a lot!

goorawin
13th July 2023, 06:51
Could you please post a sample. I recall having to remove black and white dropouts from video tapes some years ago and think I still have several scripts that did the job quite well.

StainlessS
13th July 2023, 07:26
Share a sample of your issue.
Could you please post a sample.
Sample = Unprocessed source video clip, not image.

lollo2
13th July 2023, 09:57
do you know any program or Avisynth script that can find these horizontal lines automatically in the video

A script able to identify and report the frames with the problem you mentioned is almost impossible IMO. You can have a look to this script developed by StainLess, but the problem was much more easy to identify: https://forum.doom9.org/showthread.php?t=183582
I use a customized version I made, with a low threshold value (7) for shifted fields and smaller defects.

In your case, I suspect a manual finding is required, going frame by frame.

StainlessS
13th July 2023, 15:40
Lollo2, I doubt that script <or similar> can be of any use in this case.
But sample would tell for sure if no use at all.

NLPguy
14th July 2023, 00:39
Could you please post a sample. I recall having to remove black and white dropouts from video tapes some years ago and think I still have several scripts that did the job quite well.

Sample = Unprocessed source video clip, not image.


Video Sample:


https://drive.google.com/file/d/1YI1Dv6Q7bJhA5a2Y59Y9S80qsyEuT02b/view?usp=sharing


Thank you in advance!

tmonster
14th July 2023, 17:10
Hello,
I was looking for a solution for a similar problem that I had. I too have the issue with horizontal black bars on the video. I have a good quality copy of the master edit, and some much worse off copies of the original footage.

If you want me to create a separate thread, I can, but I thought our issues were similar, so I thought I'd tag along.

Here is an example of the master footage.
https://drive.google.com/file/d/1YypyrnJ1F0eiau_iDaVT74IYdCGecij6/view?usp=sharing

I have AvisynthPlus 64 bit installed. I've run despot on it and it helps a bit, but nothing great unfortunately. I've tried devcr and remove dirt, but I can't get remove dirt to run on 64bit. Is there another script that will do the same thing, or a 64bit version?
I have a ghosting issue on the master edit (it was edited on two domestic VCRs). I have a plugin for virtualdub that will fix it, but I was wondering if there was a plugin for avisynth that would fix it.

https://drive.google.com/file/d/1_MooX4hvD35CWwFPDSTL3955nag45sPI/view?usp=sharing

Thanks for your consideration.

lollo2
14th July 2023, 22:46
For the first sample have a look to https://forum.videohelp.com/threads/403553-Restoring-VHS-Tapes-with-Damage-%28White-Horizontal-Lines-Colour-Distortion%29

tmonster
15th July 2023, 01:14
I followed your link, and I couldn't get that example to work.

I did follow a few links and found this:
https://forum.doom9.org/showpost.php?p=1483709&postcount=10

It's amazing. Rock solid, little distortion and color mangling. The only problem is that it screws up moving regular objects such as text and the wheels of vehicles.

The level of activity in the script is way beyond my capabilities. Can you suggest what to change or alter so that it does not chew up text and moving objects? I don't know if it's possible, but if so, that would be great.

On the first script, it came up with "I don't know what 'video_org' means" as an error message.

Thanks for your help!

StainlessS
15th July 2023, 01:41
tMonster,
On the first script, it came up with "I don't know what 'video_org' means" as an error message.


# interlaced fields TFF
# problem: horizontal stripe
# solution: repair with FixRipsp2

video_org=AviSource("White Line Distortion.avi").convertToYV16(interlaced=true)

# plugins directory
plugins_dir="C:\Users\giuse\Documents\VideoSoft\MPEG\AviSynth\extFilters\"

# FixRipsp2
Import(plugins_dir + "FixRipsp2.avs")
# RgTools
loadPlugin(plugins_dir + "RgTools-v1.0\x86\RgTools.dll")
# DePanEstimate
loadPlugin(plugins_dir + "depanestimate110\DePanEstimate.dll")
# FFTW
loadPlugin(plugins_dir + "LoadDll\LoadDll.dll")
loadDll(plugins_dir + "fftw3_20040130\fftw3win32mingw\fftw3.dll")
# DePan
loadPlugin(plugins_dir + "depan1131\DePan.dll")
# MaskTools2
loadPlugin(plugins_dir + "masktools2-v2.2.23\x86\masktools2.dll")
# MVTools
loadPlugin(plugins_dir + "mvtools-2.7.41-with-depans20200430\x86\mvtools2.dll")

### separate fields
video_org_sep=video_org.AssumeTFF().separateFields()

### select even fields
video_org_sep_even=SelectEven(video_org_sep)

### select odd fields
video_org_sep_odd=SelectOdd(video_org_sep)

### repair
video_org_sep_even_rep=video_org_sep_even.FixRipsp2().FixRipsp2()
video_org_sep_odd_rep=video_org_sep_odd.FixRipsp2().FixRipsp2()

### interleave
video_interleaved=interleave(video_org_sep_even_rep,video_org_sep_odd_rep)

### weave
video_restored=video_interleaved.Weave()

#return(video_restored)

stackhorizontal(\
subtitle(video_org,"video_org",size=20,align=2),\
subtitle(video_restored,"video_restored",size=20,align=2)\
)

I presume that the red code is the problem line [the error line number in the error message],
and its because you have not assigned your source clip to the blue variable.
[The clue is in the error message :) ]

tmonster
15th July 2023, 02:26
Bleh!!! I got your script running though!

I came up with 'not a clip' but managed to google my way through that. All working now!

This script works just as well as the previous one for fixing colours bouncing around, jitter, and a lot of black lines.

It does tend to eat up stuff like text and moving objects, possibly even more than the previous script. Is this fixable by tweaking some inputs?

Thanks again for your help, it looks a million times better!

lollo2
15th July 2023, 12:12
It does tend to eat up stuff like text and moving objects, possibly even more than the previous script. Is this fixable by tweaking some inputs?

Both Didee's script and FixRipSP2 are quite destructive and remove lot of details, because they are based on erasing patterns not repeating strongly across a (large enough) temporal radius.

You can play with the internal settings, but the best will probably be to use some masking and in addition to limit the action of the filters only to the concerned frames and eventually to the concerned portions of it and then use some overlap.

Not easy...

Mounir
15th July 2023, 21:31
You can try THIS (https://www.digitalfaq.com/forum/video-restore/12806-fixrips-grain-noise.html) it's a tweaked version of Didée's script i did.

tmonster
16th July 2023, 00:36
Thank you! I'll give that a try.

I think that I'm going to have to do something like what lollo2 suggested. I even have a plan for creating a black mask movie with the same number of black frames, then drawing in white on the afflicted frame numbers. Then I can use the 'mask movie' to mask between this and a version with something tamer I can use to fade in the destroyed bits.
Maybe Blender as I know how to use it's compositor. Yes, I'm a glutton for punishment!

I'll post the results when I've got something to show. Thank you all again!

tmonster
13th September 2023, 12:01
Thanks, that worked! I found that it worked best for overlaying frames that had a lot of damage to them. This is fiddly and precise work in the editor, but it's getting the job done.

I did do something like this in photoshop for certain frames as I'm not up on avisynth scripting at all. I took a frame, duplicated the layer so that I had two of the same image on top of each other. Then I gaussian blurred the underlying image. I then used the erase brush and removed the black and white stripes. It wasn't as accurate and precise as properly painting out the lines per individual image, but it looked far less distracting when animated frame-to-frame.
I don't know if something similar could be achieved in an avisynth script? Find the black or white horizontal line, erase it, blur the pixels around it to fit the hole, print to frame.

One thing that has struck me is how intensive this is for computing power. I don't have a slouch system (Ryzen 7, 32GB RAM) and this is pounding my computer. I do 3D modelling as a trade and this has a similar amount of computer hammering ability as rendering photorealistic scenes. On that note, has anyone considered talking nicely to the crew who maintain VirtualDub and see if they could get some GPU compute ability into the app? Using the graphics card to render has transformed 3D rendering completely. From 40 minutes a frame down to seconds. It would be fun to see if the same performance boost could be applied to churning through video processing!