View Full Version : repair frames
cybersharky
5th October 2013, 13:55
I though my encode had corrupted two frames, but now I've looked at the source and they are there toohttps://dl.dropboxusercontent.com/u/47490038/VTS_01_1010890.png
What can I do to repair those 2 frames?
Here's the rest of my script:
tfm(mode=0, PP=2, cthresh=2, mi=60, mChroma=false, blockx=16, blocky=16).tdecimate()
Smoothlevels(preset="tv2pc",TVrange=false)
McDegrainSharp()
manono
6th October 2013, 07:51
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.
cybersharky
6th October 2013, 08:54
Thanks, for your reply.
Here's a sample: https://dl.dropboxusercontent.com/u/47490038/VTS_3.25.demuxed.m2v
the frames are between 5-6 seconds.
manono
6th October 2013, 10:10
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 (http://www.mediafire.com/?yzk1eit2y1a85rw)
laserfan
6th October 2013, 13:59
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?:confused:
manono
6th October 2013, 19:59
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.
laserfan
7th October 2013, 13:03
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. :confused:
manono
7th October 2013, 20:06
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.
laserfan
7th October 2013, 21:10
In that case manono FreezeFrame is just what I was looking for--thinking static frames might be less jarring than bad frames!
Mahalo! :)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.