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 5th October 2013, 13:55   #1  |  Link
cybersharky
Registered User
 
Join Date: Jul 2008
Posts: 131
repair frames

I though my encode had corrupted two frames, but now I've looked at the source and they are there too

What can I do to repair those 2 frames?

Here's the rest of my script:
Code:
tfm(mode=0, PP=2, cthresh=2, mi=60, mChroma=false, blockx=16, blocky=16).tdecimate()
Smoothlevels(preset="tv2pc",TVrange=false)
McDegrainSharp()
cybersharky is offline   Reply With Quote
Old 6th October 2013, 07:51   #2  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,368
Quote:
Originally Posted by cybersharky View Post
What can I do to repair those 2 frames?
You can try interpolating from the good frames before and after those two with one of the frame interpolators. How good the results look depends mostly on how much movement there is during those two frames.
manono is offline   Reply With Quote
Old 6th October 2013, 08:54   #3  |  Link
cybersharky
Registered User
 
Join Date: Jul 2008
Posts: 131
Thanks, for your reply.

Here's a sample: https://dl.dropboxusercontent.com/u/...25.demuxed.m2v

the frames are between 5-6 seconds.

Last edited by cybersharky; 6th October 2013 at 08:59.
cybersharky is offline   Reply With Quote
Old 6th October 2013, 10:10   #4  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,368
You don't just have 2 corrupted frames but a bunch of missing frames, over a second's worth I would guess. Maybe create a scene change using FreezeFrame or use the BadFrames.dll to blend them together.

ReplaceFramesMC(290,3)#could have just used FreezeFrame
BadFrames(294,295)


Sample.mp4
manono is offline   Reply With Quote
Old 6th October 2013, 13:59   #5  |  Link
laserfan
Aging Video Hobbyist
 
Join Date: Dec 2004
Location: Off the Map
Posts: 2,463
Quote:
Originally Posted by manono View Post
You don't just have 2 corrupted frames but a bunch of missing frames, over a second's worth I would guess. Maybe create a scene change using FreezeFrame or use the BadFrames.dll to blend them together.

ReplaceFramesMC(290,3)#could have just used FreezeFrame
BadFrames(294,295)
I recently had a couple of corrupt frames myself that Morph didn't work on, and I wanted just to freeze the starting frame for a couple more, but in my surfing on it I never found ReplaceFramesMC and even now am struggling with this a bit--is this function built-in to Avisynth?
laserfan is offline   Reply With Quote
Old 6th October 2013, 19:59   #6  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,368
To use FreezeFrame to freeze two frames after the first:

FreezeFrame(X,X+2,X)#where X is the frame to be frozen

As for this ReplaceFramesMC, it's a bit better than Morph, but not a whole lot. If you get artifacts with Morph, you might with ReplaceFramesMC as well. It was modded by jagabo at videohelp.com from an earlier function called RX. It uses the SVPFlow1 and 2 DLLs, and I can't remember all what else. Here it is:

function ReplaceFramesMC(clip Source, int N, int X)
{
# Replace X frames, starting at N, with motion interpolated frames
# N is number of the 1st frame in Source that needs replacing.
# X is total number of frames to replace
#e.g. RX(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for mflowfps interpolation

start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point
end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point

start+end
AssumeFPS(1) #temporarily FPS=1 to use mflowfps

super = MSuper(pel=2, hpad=0, vpad=0, rfilter=4)
backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3)
forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3)
backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3)
forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3)
MBlockFps(super, backward_3, forward_3, num=X+1, den=1, mode=0)

AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining
Trim(1, framecount-1) #trim ends, leaving replacement frames

Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0)
}

function InsertFramesMC(clip Source, int N, int X)
{
# Insert X motion interpolated frames at N
# N is the insertion point
# X is the number of frames to insert
# the frames will be interpolated with Source frames N-1 and N as references

loop(Source, X+1, N, N)
ReplaceFramesMC(N, X)
}


But it's no cure all for motion artifacts when interpolating.
manono is offline   Reply With Quote
Old 7th October 2013, 13:03   #7  |  Link
laserfan
Aging Video Hobbyist
 
Join Date: Dec 2004
Location: Off the Map
Posts: 2,463
Quote:
Originally Posted by manono View Post
If you get artifacts with Morph, you might with ReplaceFramesMC as well...
Hmmm if frame X looks perfect, and I want to use it to replace frames X+1 and X+2, these may still have artifacts? Why? Because X is a b or p and not i?

Thanks for helping.
laserfan is offline   Reply With Quote
Old 7th October 2013, 20:06   #8  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,368
Quote:
Originally Posted by laserfan View Post
Hmmm if frame X looks perfect, and I want to use it to replace frames X+1 and X+2, these may still have artifacts? Why?
ReplaceFramesMC uses both X and X+3 to interpolate X+1 and X+2. And there are often artifacts left (odd warping, or even double or ghost images and the like). There may be too much difference in position between X and X+3 (meaning too much movement going on) to make good-looking new frames, or X and X+3 may be too different from each other in something such as luma. Also, 'turning', like a head turning around, is difficult for the interpolators to interpolate correctly.

If you just want to replace X+1 and X+2 with X, then the results are usually better if you use the built in FreezeFrame.

FreezeFrame(X,X+2,X)

It has nothing to do with I, P, or B frames.
manono is offline   Reply With Quote
Old 7th October 2013, 21:10   #9  |  Link
laserfan
Aging Video Hobbyist
 
Join Date: Dec 2004
Location: Off the Map
Posts: 2,463
In that case manono FreezeFrame is just what I was looking for--thinking static frames might be less jarring than bad frames!

Mahalo!
laserfan 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 14:31.


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