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 26th January 2015, 14:53   #1  |  Link
apostolis21
Registered User
 
apostolis21's Avatar
 
Join Date: Jan 2015
Posts: 8
Need help with blended frames

Hello everyone, this is my first post here but I always visit the forums for encoding-related issues.

I have a friend of mine who records some episodes for me from cable tv. He is then using handbrake (I don't know anything about the settings he's using) and final size becomes more manageable around 300 Mb. The problem is that somehow the encodes I get have blended frames. I would like to know if there is an avisynth filter that could reverse this.

These are three consecutive frames from the encode so as to understand what the problem is.





Here is also a small video sample from the encode

Code:
https://mega.co.nz/#!7N510DIb!Ci50J7wttLkMqBBY2vhj-Y9I5kPyf4cU_x_brbb3ikQ
I don't know if this blending is reversible but I appreciate any help
apostolis21 is offline   Reply With Quote
Old 27th January 2015, 15:37   #2  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: Los Angeles, California
Posts: 2,119
search "srestore" on forum
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated
feisty2 is offline   Reply With Quote
Old 30th January 2015, 02:16   #3  |  Link
Chthon
Registered User
 
Join Date: Dec 2012
Posts: 6
I have a similar problem, only worse. My source has blending/ghosts in *every* frame. (It looks like someone used a blur deinterlacer on fully interlaced material, slapped it on a DVD, and called it a day.) Searching turns up a number of blending removal filters, such as srestore(), but they all assume someone deinterlaced telecined material, leaving a repeating pattern of good frames and blended frames. My source has no good frames. Is there a blending removal filter that will work on this source?
Chthon is offline   Reply With Quote
Old 30th January 2015, 10:08   #4  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,380
Quote:
Originally Posted by Chthon View Post
I have a similar problem, only worse. My source has blending/ghosts in *every* frame. (It looks like someone used a blur deinterlacer on fully interlaced material, slapped it on a DVD, and called it a day.) Searching turns up a number of blending removal filters, such as srestore(), but they all assume someone deinterlaced telecined material, leaving a repeating pattern of good frames and blended frames. My source has no good frames. Is there a blending removal filter that will work on this source?
I don't think that's ever possible, since there's no basis to compare any frame to.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Old 30th January 2015, 17:58   #5  |  Link
colours
Registered User
 
colours's Avatar
 
Join Date: Mar 2014
Posts: 312
Quote:
Originally Posted by Chthon View Post
My source has no good frames. Is there a blending removal filter that will work on this source?
I've had the "pleasure" of messing with a source that also had every frame blended about three years ago, though mine was more like someone applied a blend deinterlacer to an already-progressive source. While I didn't really get satisfactory results then (even though that's a much simpler problem than unblending an interlaced source), I wouldn't mind taking a stab on your source. But don't get your hopes up or anything, it's probably not fixable.

Start a new thread for that, maybe?
__________________
Say no to AviSynth 2.5.8 and DirectShowSource!
colours is offline   Reply With Quote
Old 30th January 2015, 18:38   #6  |  Link
Chthon
Registered User
 
Join Date: Dec 2012
Posts: 6
Quote:
Originally Posted by foxyshadis View Post
I don't think that's ever possible, since there's no basis to compare any frame to.
Thanks for the reply. I was afraid that was the case, but hoping I was wrong.

I've put some thought into it, and I think I may have a solution. I'd greatly appreciate it if someone could sanity check this idea before I waste time trying to implement it:

My mind's eye pictures the frames I want to recover as a series 180 degrees out of phase with the frames I have, like so:
Code:
A   B   C   D   E   F <- have these
  v   w   x   y   z   <- want these
Is that correct?

Assuming that whoever made this mess used a naive blur function, then the frames I have should be a simple average of the adjacent frames I want. E.g., B=(v+w)/2. Correct?

Although I said there are "no good frames," that may not be literally true. What if there are two identical adjacent frames? That would give me one good unblurred frame. Then I could proceed iteratively computing each unblurred frame from its unblurred neighbor and the blurred frame between them. E.g. unblurred_frame = (2*blurred_frame) - unblurred_neighbor.

AFAIK, avisynth doesn't do "iterative," since that kind of runs counter to the whole "frameserver" concept. But, I could probably jury-rig something by dumping the frames to png and writing something to process the pngs iteratively. Then read the pngs back into avisynth.

Even if there are no identical frames, perhaps it would still work by finding pairs of very similar adjacent frames. I could approximate the unblurred frame in between by averaging such a pair. Then maybe do two passes -- one forward from the last pair and one backward from the next pair -- and average the results. That should at least reduce the blur down to the sum of 1/4 of the blur present in each pair... I think...

Someone please stop me if I'm way off on the wrong track here.
Chthon is offline   Reply With Quote
Old 31st January 2015, 01:37   #7  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,380
Quote:
Originally Posted by Chthon View Post
Thanks for the reply. I was afraid that was the case, but hoping I was wrong.

I've put some thought into it, and I think I may have a solution. I'd greatly appreciate it if someone could sanity check this idea before I waste time trying to implement it:

My mind's eye pictures the frames I want to recover as a series 180 degrees out of phase with the frames I have, like so:
Code:
A   B   C   D   E   F <- have these
  v   w   x   y   z   <- want these
Is that correct?

Assuming that whoever made this mess used a naive blur function, then the frames I have should be a simple average of the adjacent frames I want. E.g., B=(v+w)/2. Correct?

Although I said there are "no good frames," that may not be literally true. What if there are two identical adjacent frames? That would give me one good unblurred frame. Then I could proceed iteratively computing each unblurred frame from its unblurred neighbor and the blurred frame between them. E.g. unblurred_frame = (2*blurred_frame) - unblurred_neighbor.

AFAIK, avisynth doesn't do "iterative," since that kind of runs counter to the whole "frameserver" concept. But, I could probably jury-rig something by dumping the frames to png and writing something to process the pngs iteratively. Then read the pngs back into avisynth.

Even if there are no identical frames, perhaps it would still work by finding pairs of very similar adjacent frames. I could approximate the unblurred frame in between by averaging such a pair. Then maybe do two passes -- one forward from the last pair and one backward from the next pair -- and average the results. That should at least reduce the blur down to the sum of 1/4 of the blur present in each pair... I think...

Someone please stop me if I'm way off on the wrong track here.
The phase subtraction would work if it was temporally blurred, so that each field was partially in two frames, like Ab-bCd-dEf. That way you could puzzle out the matching areas across two frames and either keep or clear them. But blend-deinterlacing is almost always done by compressing two fields into one frame with a vertical blur, so that where you had A-B-C-D-E-F it becomes AB-CD-EF, and no remnant is left over. The only clear frames you'll get are total or near duplicates, as you say, but as soon as motion occurs you're back to square one. You can't start a chain of deblends because the chain breaks every frame.

It would be cool to have a motion-compensating deblending, based on edges, but that seems even harder to realize than regular motion compensation.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Old 31st January 2015, 03:25   #8  |  Link
colours
Registered User
 
colours's Avatar
 
Join Date: Mar 2014
Posts: 312
Quote:
Originally Posted by Chthon View Post
Even if there are no identical frames, perhaps it would still work by finding pairs of very similar adjacent frames. I could approximate the unblurred frame in between by averaging such a pair. Then maybe do two passes -- one forward from the last pair and one backward from the next pair -- and average the results. That should at least reduce the blur down to the sum of 1/4 of the blur present in each pair... I think...

Someone please stop me if I'm way off on the wrong track here.
This was one of the first things I tried. The problem is that this looks really terrible because of the pre-ghosting, where anything that moves shows up with ghosts a frame too early. Worse yet, sometimes the ghosting will be negative, which looks far more jarring than normal ghosting.

It's not really useful to just think of it as blur along the time dimension because most video is captured with a lot more temporal aliasing than spatial aliasing, so you can't just apply the same techniques for spatial deconvolution to temporal blur. (One of the largest drawbacks to trying to do this in an Avisynth script is that recursive/IIR filters are very inconvenient because they enforce a particular seeking order.)

It's also important (as foxyshadis mentioned) to distinguish whether your source is really blend-deinterlaced material or merely temporally blurred. They're both not really fixable, but the latter seems slightly less impossible IMO.
__________________
Say no to AviSynth 2.5.8 and DirectShowSource!

Last edited by colours; 31st January 2015 at 03:35.
colours is offline   Reply With Quote
Old 31st January 2015, 04:14   #9  |  Link
Chthon
Registered User
 
Join Date: Dec 2012
Posts: 6
Thank you both very much for your help.

I took another, closer look at it. Sure enough, it's a vertical blur. So... drat.

I can upload a chunk if anyone wants to fiddle with it, but I've pretty much resigned myself to living with the blur.

Thanks again!
Chthon is offline   Reply With Quote
Reply

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 15:41.


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