Hey! I have a video file I'd like to restore, which has weird horizontal lines all over it. I think it might be a bad deinterlacing job, but to be honest I'm unsure what it is exactly. This is how the source looks. How would I go about fixing something like this? (I know the aspect ratio is not correct). Sample attached. Thanks!
+ Reply to Thread
Results 1 to 25 of 25
-
-
It looks like the image has been poorly resized in the vertical direction. Rather than interpolating smoothly from 720p to 480p, I believe two lines have simply been discarded every four lines. To try to undo this, you need to replace those missing rows somehow and then resize the video correctly.
Original, stripey image:

Empty space inserted every four pixels, stair stepping is largely gone:

Missing lines filled in:

And resized back to the original height:

You can achieve this with something like the following in AviSynth
Of course, I have just used a rather crude Merge() call to fill in the missing lines. You could get more creative with NNEDI() or other ways to interpolate the missing data, and of course also add further anti-aliasing after the fix.Code:SeparateRows(8) x0 = SelectEvery(8, 0) x1 = SelectEvery(8, 1) x2 = SelectEvery(8, 2) x3 = SelectEvery(8, 3) x4 = SelectEvery(8, 4) x5 = SelectEvery(8, 5) x6 = SelectEvery(8, 6) x7 = SelectEvery(8, 7) # Create filler for missing lines a2 = Merge(x2,x3, 0.33) a3 = Merge(x2,x3, 0.67) a6 = Merge(x6,x7, 0.33) a7 = Merge(x6,x7, 0.67) # Insert filler and put image back together Interleave(x0,x1,x2, a2,a3, x3,x4,x5,x6, a6,a7, x7) WeaveRows(12) # Return image back to original dimensions BilinearResize(width(), 480)
Still, just doing this much removes a lot of the stripey-ness from the video; I've included a clip with the original and fixed side by side. -
It should be fairly straightforward as no external filters are used, except for a source filter of your choosing.
I also realized that the stripe pattern already repeats after four lines - I went with eight while trying to figure out what exactly is missing. This shorter script should perform exactly the same correction:
Code:SeparateRows(4) x0 = SelectEvery(4, 0) x1 = SelectEvery(4, 1) x2 = SelectEvery(4, 2) x3 = SelectEvery(4, 3) # Create filler for missing lines a2 = Merge(x2,x3, 0.33) a3 = Merge(x2,x3, 0.67) # Insert filler and put image back together Interleave(x0,x1,x2, a2,a3, x3) WeaveRows(6) # Return image back to original dimensions BilinearResize(width(), 480)
-
I'm getting this error, even though I installed the only version of Avisynth I can see, which should be 32 bit. What do I need to change?
[Attachment 57770 - Click to enlarge] -
Hmm... well the message certainly seems to indicate that a 64 bit AviSynth is being used - is it possible you have multiple copies installed, perhaps some other package you have installed included AviSynth with it?
The versions I am using are AviSynth+ (64 bit) and the FFmpegSource plugin for loading videos. -
Okay, so I reinstalled Avisynth+, and deleted it with its own uninstaller this time. Now it gives this error:
[Attachment 57772 - Click to enlarge]
Script looks like this:
Code:# DGDecode: LoadPlugin("d:\Data\dgmpgdec2005\dgdecode.dll") MPEG2Source("d:\Data\MattyP\vegas\full.d2v") SeparateRows(4) x0 = SelectEvery(4, 0) x1 = SelectEvery(4, 1) x2 = SelectEvery(4, 2) x3 = SelectEvery(4, 3) # Create filler for missing lines a2 = Merge(x2,x3, 0.33) a3 = Merge(x2,x3, 0.67) # Insert filler and put image back together Interleave(x0,x1,x2, a2,a3, x3) WeaveRows(6) # Return image back to original dimensions Spline64Resize(width(), 480) -
Open your scripts with VirtualDub2. It should give you a better error message.
One of the main things to watch out for is "bitness". If you use a 32 bit editor/encoder you must have 32 bit AviSynth installed and 32 bit versions of all the 3rd party filters. If you use a 64 bit editor/encoder you need to have 64 bit AviSynth installed and 64 bit versions of all the 3rd party filters.
Note that SeparateRows() and WeaveRows() are not included in AviSynth, only AviSynth+. -
Looks alright to me - does it work if you leave out everything after MPEG2Source()? If yes, it could be the SeparateRows() call, it was added in AviSynth 2.60 so an older version would fail there.
You could also try loading the script in VirtualDub, perhaps it can present a more meaningful error message. -
I remade the d2v file with only one of the VOBs instead of all 3, it now opens the script without error messages in Virtualdub (still gives an error in command prompt). Processing seems to be non-existent though. Does it just not execute filters when they're not available? Because then the problem could be that they're just missing from the install.
-
It should definitely complain "There is no function named --" if an unknown command is used. Can you try the script on the exact same sample you posted here? It's possible that the broken scaling is not constant throughout the full video, and adjustments would be needed.
-
-
It looks like I can't process the exact sample I uploaded here, DGIndex says "Error: No video sequence header found!". I processed the entirety of the first VOB though (where it should've thrown an error for missing plugins), and it ran and finished it. It skipped over the missing plugins, because it did perform the resize (I changed it from 480 to 720) that was the very last command.
-
Hmm, well I don't know what to say. The script runs yet there is no visible difference at all, the jagged edges remain untouched? I mean this method won't get rid of all the aliasing (some information has simply been thrown away in the bad resize), but you should at least see the improvements like in my sample video.
-
Are you saying both ffmepg and VirtualDub both give the exact same message?
-
No, sorry, I misunderstood you. ffmpeg throws a generic error:Are you saying both ffmepg and VirtualDub both give the exact same message?
[Attachment 57775 - Click to enlarge] -
Then you are probably using 32 bit VirtualDub with 32 bit AviSynth, and 64 bit ffmpeg but don't have 64 bit AviSynth installed. Or are trying to load a 32 bit filter into 64 bit AviSynth:
That lines needs to point to a 64 bit version of dgdecode.dll. Or just get a 32 bit version of ffmpeg.Code:LoadPlugin("d:\Data\dgmpgdec2005\dgdecode.dll") -
So now that I can I did this through ffmpeg, and it didn't say anything. Here's the script and command I ran:
and the command:Code:# DGDecode: # LoadPlugin("d:\Data\dgmpgdec2005\dgdecode.dll") # MPEG2Source("d:\Data\MattyP\vegas\full.d2v") LoadPlugin("c:\Users\Me\Downloads\ffms2-2.40-msvc\ffms2-2.40-msvc\x86\ffms2.dll") FFmpegSource2("d:\Data\MattyP\vegas\vegas08sample.mp4") SeparateRows(4) x0 = SelectEvery(4, 0) x1 = SelectEvery(4, 1) x2 = SelectEvery(4, 2) x3 = SelectEvery(4, 3) # Create filler for missing lines a2 = Merge(x2,x3, 0.33) a3 = Merge(x2,x3, 0.67) # Insert filler and put image back together Interleave(x0,x1,x2, a2,a3, x3) WeaveRows(6) # Return image back to original dimensions Spline64Resize(width(), 720)It seems to me that it did run the script somehow, as the video was resized to 720 in height. It didn't complain about missing plugins though, but it didn't execute them either.Code:ffmpeg -i script.avs -c:v libx264 -preset veryslow -crf 16 "output.264"
-
Are you sure the filters are not being executed? How about if you change the filler lines like this:
That should leave very obvious black lines in the image. If so, then the SeparateRows() etc. filters are definitely being run.Code:# Create filler for missing lines a2 = BlankClip(x0) a3 = BlankClip(x0)
You don't need to encode a long video to check the result - just load the script in VirtualDub and see what it looks like there. -
Thank you for this, yes, you were right, they were being run. I'm doing a full encode of VTS 1 with the original filters to compare with the source.
Similar Threads
-
How would you restore this clip?
By SomeoneNeutral in forum RestorationReplies: 5Last Post: 4th Mar 2021, 10:15 -
What would be the best way to restore this old footage?
By SomeoneNeutral in forum RestorationReplies: 8Last Post: 5th Sep 2019, 06:27 -
Can someone restore this file?
By coco3456 in forum RestorationReplies: 0Last Post: 5th Jan 2019, 02:47 -
Can I come to restore this video?
By ciccioschumacher in forum RestorationReplies: 120Last Post: 11th Apr 2018, 00:53 -
Can someone help me restore this
By Starfx in forum RestorationReplies: 10Last Post: 13th Aug 2017, 13:33



Quote