I spent the last 10 days trying to fix a short clip with no success. It is supposedly interlaced but it shows progressive frames which look just like upsized fields. There are also dupped fields, and missing fields (jumping gaps) on no pattern order.
I made a thread here explaining the problem in detail and exposing some takes and comes out.
17Mb
http://www.mediafire.com/?t26hmac5kyawyqf
My intention is to make this a temporal even spaced 59.94fps.
For that I first drop half the frames (since they are dups), then I nnedi3() the fields to make them suitable for motion interpolation. Interpolate (to create the missing fields gaps) and convert back to fields with separatefields(). Now I need to take all the needed fields (original and interpolated missing fields) in a certain order Top+Bottom or Bottom+Top, and here comes the problem, when I select a field belonging to a missing field (interpolated) the next field I must choose (top or bottom) isn't the original field anymore but the nnedi3 interpolated part of it.
These are the related posts about this issue. Here and here.
This the code I have just before selecting the correct fields.
And this the behind thinking/scheme to picture the overall issue.Code:setmtmode(3,2) MPEG2Source("source.d2v", cpu=0) setmtmode(2,2) Trim(0,926) separatefields() #chroma fix interleave(selectevery(4,0),selectevery(4,1),mergechroma(selectevery(4,2),selectevery(4,-0)),selectevery(4,3)) # drop dups b=0 selectevery(4,b+2,b+3) t=trim(774,926).selecteven.TemporalSoften(10,255,255,25,2) trim(0,773)+interleave(t,t) # Fixing all the crap out of the fields # back to initial state weave() # start from problematic section trim(252,0) a=last # preparing for interpolation nnedi3(field=-2) assumefps(10) # interpolation chroma=true superV = MSuper(pel=2) vbo=MAnalyse(superV,isb=true, overlap=4, delta=1,chroma=chroma,search=3) vbo=MRecalculate(superV,vbo, overlap=2,blksize=4,chroma=chroma) vfo=MAnalyse(superV,isb=false, overlap=4,delta=1,chroma=chroma,search=3) vfo=MRecalculate(superV,vfo, overlap=2,blksize=4,chroma=chroma) MFlowFps(MSuper(pel=2,levels=1), vbo, vfo, num=20,den=1)
Thank you!Code:i=interlaced frame f=field frame 1) Numbering (useful for selectevery()) 2) Interlacing of original source (after trim(252,0)) 3) Fields of original source (after trim(252,0)) 4) Fields after Motion Interpolation. (in the form of frames from nnedi3 output) 5) Fields after Motion Interpolation. (same as 4) after separatefields()) Capital letter is top field. 6) The nnedi3 (spatial interpolated) part of original (and motion interpolated) fields (aka garbage) for the 5) line. 1) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 253 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 2) f i f f i i f f i f f i f f i i f f i f f i f f i i f f i f f i i f i i f f i f f i i f f i f f i f f i i f f i f f i i f f i f f i f f i i f f i f f i f f i i f f i f f i f f i i f f i f f i i f f i f f i f f i i f f i f f i i f f i f f i f f i i f f i f f i f f i i f f 3) aa bc dd ff gh ij kk mm no pp rr st uu ww xy za bb dd ef gg ii jk ll nn op qr ss uu vw xx zz ab cd ee fg hi jj ll mn oo qq rs tu vv xx yz aa cc de ff hh ij kl mm oo pq rr tt uv wx yy aa bc dd ff gh ii kk lm no pp rr st uu ww xy zz bb cd ef gg ii jk ll nn op qq ss tu vw xx zz ab cc ee fg hi jj ll mn oo qq rs tt vv wx yz aa cc de ff hh ij kl mm oo pq rr tt uv ww yy za bc dd ff gh ii kk lm nn pp qr st uu vv 4) a x a x b x c x d x d x f x f x g x h x i x j x k x k x m x m x n x o x p x p x r x r x s x t x u x u x w x w x X x y x z x a x b x b x d x d x e x f x g x g x i x i x j x k x l x l x n x n x o x p x q x r x s x s x u x u x v x w x X x X x z x z x a x b x c x d x e x e x f x g x h x i x j x j x l x l x m x n x o x o x q x q x r x s x t x u x v x v x X x X x y x z x a x a x c x c x d x e x f x f x h x h x i x j x k x l x m x m x o x o x p x q x r x r x t x t x u x v x w x X x y x y x a x a x b x c x d x d x f x f x g x h x i x i x k x k x l x m x n x o x p x p x r x r x s x t x u x u x w x w x X x y x z x z x b x b x c x d x e x f x g x g x i x i x j x k x l x l x n x n x o x p x q x q x s x s x t x u x v x w x X x X x z x z x a x b x c x c x e x e x f x g x h x i x j x j x l x l x m x n x o x o x q x q x r x s x t x t x v x v x w x X x y x z x a x a x c x c x d x e x f x f x h x h x i x j x k x l x m x m x o x o x p x q x r x r x t x t x u x v x w x w x y x y x z x a x b x c x d x d x f x f x g x h x i x i x k x k x l x m x n x n x p x p x q x r x s x t x u x u x v x v 5) a A x x a A x x b B x x c C x x d D x x d D x XT f F x x f F x x g G x x h H x x i I x x j J x x k K x x k K x XT m M 6) n n n n n n n n n n n n n n n n
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 7 of 7
Thread
-
-
I have read your other thread, but honestly, I think you should do this...
selectevery(2,0)
bob()
step through in virtualdub and note the frame numbers of the near-duplicated frames.
Then create this code...
selectevery(2,0)
qtgmc()
adding the mvtools code from this thread...
http://forum.doom9.org/showthread.php?t=152758
...to replace each frame you noted as a bad frame above.
That's it. No need to re-interlace. You already have the frame rate you want, and there wasn't enough motion in the original for smooth 60fps motion anyway. You could create it at the end by using mflowfps to interpolate the whole lot to 60fps and then re-interlace, but using mflowfps that much might introduce artefacts. Your call.
Only process the slow-mo part. Don't touch the rest.
Cheers,
David.
P.S. the frames aren't duplicated - selectevery(2,0) is actually throwing away a fade on the titles which is unique to each frame - but I wouldn't worry about that. -
yes, it's a nice workaround. Not a solution but good enough to do it and end with this. The problem is that not all dups (or near dups) imply there is a time gap, note about ff gh. So the resulting framerate will be lower, around 25-ish I guess, so I will need something like:
assumefps(23.976)
interleave(last,last,last) # to 71fps
selectevery(6,0,1,3,4,5) # to 59.940
Your code is not ideal because some frames are not interlaced, so they are just like dups for the deinterlacer, plus the mentioned time gaps, so in a manner is like deinterlacing animation, something smart bobbers are not good with, better explained in this post from Didée. But I'm very tired of this now and need to keep going, if somebody wants some avisynth self challenge there already are 2 threads of background theorizing on this clip.
About interpolation I don't know which one to use. I have these 2. I remember reading something not good about ReplaceFramesSimple() so I dunno. Also all of them use MFlowInter instead of MFlowFPS:
Code:function morph (clip c, int in, int "out", int "blksize") { Function fill_loop(string s, int stop, int count) { return (stop == 0) ? s : string("tofill.mflowinter(morph_spr,fill_vb,fill_vf,time=" + string(100*(count - stop)/float(count))) + ",thscd1=255,thscd2=255).selectevery(tofill.framecount(),0)," + fill_loop(s,stop-1,count) } out = default(out, in+2) blksize = default(blksize,16) d=c.trim(in,out)# in-1? tofill=d.selectevery(c.framecount(),0,c.framecount()-1) morph_spr=tofill.msuper() fill_vb=morph_spr.manalyse(truemotion=true,blksize=blksize,isb=true,overlap=blksize/2) fill_vf=morph_spr.manalyse(truemotion=true,blksize=blksize,isb=false,overlap=blksize/2) filled=eval("interleave(" + fill_loop("" ,d.framecount()-1,d.framecount()-1) + "tofill.selectevery(tofill.framecount(),tofill.framecount())).assumefps(c.framerate())") c.trim(0,-(in+1))++filled.trim(1,d.framecount-2)++c.trim(out,0)}
Code:function FixBadFrames(clip c, string frames) { # Replace each frame from a list of 'bad' frames by using MFlowInter to interpolate # between the nearest pair of 'good' frames c sup = MSuper() bv = MAnalyse(sup, isb=true, delta=2) fv = MAnalyse(sup, isb=false, delta=2) candidates = MFlowInter(sup, bv, fv, time=50.0, ml=100).DuplicateFrame(0) ReplaceFramesSimple(candidates, mappings=frames) }
-
I think you must have misunderstood what I wrote, because it doesn't change the frame rate at all, or the number of frames.
Your code is not ideal because some frames are not interlaced, so they are just like dups for the deinterlacer
What does matter is that (I think!) some top fields from the original not-slowed-down source have been pasted as bottom fields in the badly-slowed-down output that you have to work with. So there's a slight vertical bounce. But given the rather random zoom in, it hardly matters.
I'm amazed if you can, with 100% certainty, figure out the exact relationship between the original not-slowed-down source and the badly-slowed-down output that you have to work with. I agree you're probably right, but you can't know - which means that any automatically generated output that looks as good is, by definition, as good.
About interpolation I don't know which one to use. I have these 2. I remember reading something not good about ReplaceFramesSimple() so I dunno.
Motion interpolation is rarely perfect. If it looks OK and doesn't crash AVIsynth, be happy.
Also all of them use MFlowInter instead of MFlowFPS
I don't have as much patience as you though. My solution would take two minutes. It's what I posted above, plus ReplaceFramesSimple("some frame numbers here") - and those frame numbers would take maybe a minute to figure out just by stepping through the video output by my first script and writing down the near-dups.
Cheers,
David. -
Thanks for the feedback.
I think I understood your solution, but if I replace every output dup frame with an interpolated one there will be occasionally strings of 3 close frames, closer in time than the rest. I analyzed the source without all the dups and I only detected time gaps between for example dd ff, but not between ff and gh.
QTGMC always gave me problems if the source has not smooth motion. What I discovered recently and which works very good for animation is that by using the lossless mode you don't get ghosting. It's much slower but the best solution, although that doesn't mean I get ghosting in this case. I was just trying to be "academic" as per Didées post, but for this case exceptionally I don't care anymore.
Thanks for the clarification on MFlow, I never understood why there were 2 functions for the same task and documentation never explained. I always used MFlowFPS because there is nothing it can't do that MFlowInter does, but after some tests I got slightly better results with the latter, probably because the ml and time parameters.
About your solution yes it's fast, I'm just dealing with another matter right now. The second dup has a shift of one pixel upwards, I think always but need to check. So I'm trying to shift all these back to normal with:
str_b = "
0 1 0
0 0 0
0 0 0 1"
mt_edge(trim(21,-1),str_b,0,255,0,255,U=3,V=3)
and depending on which of both dups has better quality, keep this version or the other. With all the camera work involved it's hard to know.
Ok, time to get my hands working. -
Just to clarify this, I'm not aware of any problem with ReplaceFramesSimple itself.
What 2Bdecided is saying (correctly) is that my FixBadFrames function (which uses ReplaceFramesSimple) is only designed to handle isolated bad frames and can't fix adjacent bad frames.
It's strength lies in being simple to use, as you supply all the bad frames in a list in a single call to the function. -
I had something in the back of my mind with remapframessimple, probably regarding multithreading and also some issues pointed when clipclop was released. Anyways I already filtered the clip and it looks nice knowing the garbage where it came from. In the end MFlowInter feels to perform better specially when interpolation is wrong, instead of mangling the pixels it uses a blend approach or so it seems.
45Mb
http://www.mediafire.com/?7i4b9serdq37kka
I proceed to post my final script and procedures:
Code:setmtmode(3,2) MPEG2Source("source.d2v", cpu=0) setmtmode(2,2) Trim(0,926) separatefields() #chroma fix interleave(selectevery(4,0),selectevery(4,1),mergechroma(selectevery(4,2),selectevery(4,-0)),selectevery(4,3)) a=weave.trim(504,0) # drop dups b=0 selectevery(4,b+2,b+3) t=trim(774,926).selecteven.TemporalSoften(10,255,255,25,2) trim(0,773)+interleave(t,t) # Fixing all the crap out of the fields # back to initial state weave() # start from problematic section trim(252,0) # Deinterlace QTGMC(tr2=3,preset="slower",lsb=true,chromamotion=false,edithreads=2) # Remove garbage dups (the worst of the pair not replacing any time gap frame) deleteframe(7, 14, 20, 26, 35, 40, 47, 54, 58, 66, 72, 80, 89, 94, 100, 106, 114, 122, 129, 134, 143, 149, 154, 163, 166, 174, 183, 189, 196, 202, 206, 216, 220, 228, 234, 240, 248, 254, 260, 269) # Replace time gap dups fixbadframes("5 12 17 22 29 34 39 46 51 63 68 75 80 85 92 97 104 109 114 121 126 131 138 143 148 155 160 167 172 177 184 189 196 201 206 213 218 223 230") fixed=last # Block fix for last part shimmer trim(231,0) str_b = " 0 1 0 0 0 0 0 0 0 1" interleave(selectevery(2,0),mt_edge(selectevery(2,1),str_b,0,255,0,255,U=3,V=3)) sharp=last DeStripeV(1) TemporalSoften(10,255,255,25,2) Contrasharpening(last,sharp) fixed.trim(0,230)+last # Delete first frame Dup # Convert to 59.940 and loop section to comply to original duration trim(1,0) loop(2,290,330) interleave(last,last) assumefps(60000,1001)
Code:# 1) Numbering # 2) fields distribution # 3) Removed not time concerned dups # 4) Rearranged 3) to know the numbering of left dups (dups that need to be replaced with a motion interpolated substitute) # 1) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 253 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 # 2) a a b c d d f f g h i j k k m m n o p p r r s t u u w w x y z a b b d d e f g g i i j k l l n n o p q r s s u u v w x x z z a b c d e e f g h i j j l l m n o o q q r s t u v v x x y z a a c c d e f f h h i j k l m m o o p q r r t t u v w x y y a a b c d d f f g h i i k k l m n o p p r r s t u u w w x y z z b b c d e f g g i i j k l l n n o p q q s s t u v w x x z z a b c c e e f g h i j j l l m n o o q q r s t t v v w x y z a a c c d e f f h h i j k l m m o o p q r r t t u v w w y y z a b c d d f f g h i i k k l m n n p p q r s t u u v v # 3) a a b c d d f g h i j k k m n o p p r s t u u w x y z a b b d e f g g i j k l l n o p q r s s u v w x z z a b c d e f g h i j l l m n o o q r s t u v v x y z a a c d e f f h i j k l m o o p q r r t u v w x y y a b c d d f g h i i k l m n o p p r s t u u w x y z z b c d e f g g i j k l n n o p q q s t u v w x x z a b c c e f g h i j j l m n o o q r s t v v w x y z a a c d e f h h i j k l m o o p q r t t u v w y y z a b c d f f g h i k k l m n p p q r s t u v # 4) a a b c d d f g h i j k k m n o p p r s t u u w x y z a b b d e f g g i j k l l n o p q r s s u v w x z z a b c d e f g h i j l l m n o o q r s t u v v x y z a a c d e f f h i j k l m o o p q r r t u v w x y y a b c d d f g h i i k l m n o p p r s t u u w x y z z b c d e f g g i j k l n n o p q q s t u v w x x z a b c c e f g h i j j l m n o o q r s t v v w x y z a a c d e f h h i j k l m o o p q r t t u v w y y z a b c d f f g h i k k l m n p p q r s t u v
Bookmarks Frame Number to Typed Number.py
http://www.mediafire.com/?5dlxtdpn3phm67h
Similar Threads
-
VHS with interlaced AND rolling FIELDS?
By Heiler in forum RestorationReplies: 22Last Post: 22nd Oct 2011, 17:08 -
Premiere Pro CS3 out-of-order/missing fields but progressive content?
By Black Knight in forum EditingReplies: 39Last Post: 13th Apr 2010, 22:03 -
Am I missing something here? - DVD to resized, interlaced DivX
By wiseant in forum Video ConversionReplies: 8Last Post: 29th Aug 2008, 11:43 -
Newbie frame/ field - capture both interlaced fields
By peter bradbeer in forum SVCD2DVD & VOB2MPGReplies: 8Last Post: 8th Feb 2008, 14:36 -
How to deal with 23.97 interlaced source
By mpiper in forum Authoring (DVD)Replies: 18Last Post: 15th Dec 2007, 22:45