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. |
26th May 2013, 06:27 | #1 | Link |
Registered User
Join Date: Sep 2005
Posts: 558
|
(Yet Another) Weird Pattern 25 -> 29.97 telecined
I've been banging my head against a piece of interlaced video (29.97) for a couple days.
I tried IVTC'ing with TFM and Telecide (then decimating). The output keeps ending up jittery. (Duplicate and missing frames). Finally in disgust I used bob() and counted unique fields and discovered the source to be 25 fps. The thing is there is no ghosting, blending or anything wierd. Just 25 unique fields and a very strange pattern of duplicates. My current script looks like: Code:
qtgmc(Preset="medium") fdecimate(25) assumefps(23.976) The point being, this method is slow (even at Medium). TFM will inverse telecine to 29.97 but drop frames (that I can see with a bobber). It would be quicker and produce better quality to IVTC directly, but I know of no filter that is tunable to match fields for frame rates besides 29.97. Suggestions? |
26th May 2013, 07:02 | #2 | Link | ||
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
My first suggestion is that you provide a sample. If you're asking here what to do, maybe you don't know how to diagnose what you have either. Samples are always better than descriptions.
Anyway, based on your description, maybe this will work: TFM() Tdecimate(Mode=0,Cycle=6,CycleR=1) But I'd still feel more comfortable offering advice if there was a sample included. Quote:
Quote:
Last edited by manono; 26th May 2013 at 07:04. |
||
26th May 2013, 15:21 | #3 | Link |
Registered User
Join Date: Dec 2007
Location: Germany
Posts: 632
|
Please provide a sample.
From your description it sounds like 25p wrapped in 29.97i using pulldown. Nothing weird about that. Manono's suggestion would deal with exactly that (result would be 24.97 fps which can be left as is or speed up to 25 fps). If you're unlucky, editing has been done in 29.97i. |
26th May 2013, 16:45 | #4 | Link | |||
Registered User
Join Date: Sep 2005
Posts: 558
|
Quote:
Quote:
Haven't had a moment to test this yet, will a bit later. Quote:
If by orphaned fields, you mean single fields without a match, yeah, I've got them. I assumed they'd end up as a remaining combed frame that gets passed to the post processor. |
|||
26th May 2013, 20:45 | #5 | Link |
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
It's dropping fields. And yes, they're orphaned fields - fields for which there's no match. TFM won't create a duplicate for an orphaned field on which to match, or bob it. It'll just drop it. This is a most peculiar way to convert PAL to NTSC. I'd do it as you showed in your first post, maybe changing the decimate portion to:
TDecimate(Mode=0,Cycle=60,CycleR=35) But it doesn't matter a whole lot. Ignore the jump on frame 15 because there isn't a full cycle on which it can work. Edit: I was thinking about this some more. The only IVTC that bobs fields if needed is the old SmartDecimate. I tried it and even it had trouble going straight to the final framerate. But if field-matching/bobbing to 29.97 followed by a decimate, it did better. Here's the script: SmartDecimate(30,60) TDecimate(Mode=0,Cycle=30,CycleR=5) Here's an MP4 I made of it. I can't tell if it's perfect or not but, while it isn't as fast as using TIVTC alone, it's way faster than having QTGMC in there: https://mega.co.nz/#!kJxwERSK!ZaG5iH...PB2R-O1ikP4as0 Last edited by manono; 26th May 2013 at 21:33. |
27th May 2013, 00:12 | #6 | Link |
Registered User
Join Date: Sep 2005
Posts: 558
|
Good suggestions, manono.
TDecimate seemed to hit on unique frames more accurately. SmartDecimate preserves a lot more detail. Which onsidering the condition of the source is nice. I play around with that some more, but that looks to be the best answer... and much faster. Edit: I cannot get my head around what exactly it is that SmartDecimate is doing. The page doesn't make a lot of sense when I read it. http://avisynth.org.ru/docs/english/...rtdecimate.htm Last edited by DoctorM; 27th May 2013 at 00:19. |
27th May 2013, 01:41 | #7 | Link | |
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
Quote:
Think of it as a regular IVTC with the extra added attraction of being able to use bobbed fields when needed. I believe it was developed as a way to get a single framerate out of hybrid material - things like the Star Trek spinoffs where there's a mix of film and interlaced computer generated material. By being able to use bobbed fields on occasion, it's better at getting nicer-looking results from the video portions than the Decomb or TIVTC methods of blending frames (when converting from interlaced 29.97fps to progressive 23.976fps). Knowing that, I decided to see if it worked with your sample or other material with orphaned fields. It does, after a fashion. I think it bobbed and kept all the orphaned fields, but because the duplicate pattern was peculiar afterwards, I decided TDecimate was better to remove those dupes. As I mentioned, I used SmartDecimate to get progressive 29.97fps from your source, before then using TDecimate to bring it down to 24.975fps. You'll notice it uses the AviSynth Bob filter when bobbing. You might want to use a better bobber when needed, maybe even QTGMC. The manual explains how to replace Bob with any bobber you might want to use. Last edited by manono; 27th May 2013 at 01:55. |
|
27th May 2013, 21:22 | #8 | Link |
Registered User
Join Date: Sep 2005
Posts: 558
|
Good point. There are some confusing details about the filter. At one point it is just about saying it decombs instead of matching fields and then later you can set how aggressively it matches fields.
Good eyes with the bob= option. Missed that. Unfortunately, Yadif, Yadifmod and qtgmc all cause a crash. Either a silent crash or a program error (not avisynth) (Media Player Classic, VDubMod, etc.) and "R6025 Pure Virtual Function Call". Even dgbob (their example) didn't work. Huh? Not sure what's going on there. |
28th May 2013, 00:02 | #9 | Link |
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
Yeah, I had trouble getting it going too. It's been years since I used it and several AviSynth versions ago. Maybe someone with more knowledge than I can give a more efficient way to set it up, but what made it work for me was sticking the other needed DLLs before the AviSynth_C.dll needed by SmartDecimate. I couldn't get it going with either the LoadCPlugin or StdCallPlugin. Something like this worked:
LoadPlugin("D:\AviSynth Stuff\Dlls\DGDecode.dll") LoadCPlugin("D:\AviSynth Stuff\Dlls\Yadif.dll") LoadPlugin("D:\AviSynth Stuff\Dlls\avisynth_c.dll")#Yadif before AviSynth_C.dll LoadCplugin("D:\AviSynth Stuff\Dlls\SmartDecimate.dll") LoadPlugin("D:\AviSynth Stuff\Dlls\TIVTC.dll") MPEG2Source("E:\Test\Test.d2v") SmartDecimate(30,60,Bob=Yadif(Mode=1)) TDecimate(Mode=0,Cycle=30,CycleR=5) But as I said, there are probably better ways to set it up. |
28th May 2013, 05:33 | #11 | Link |
Registered User
Join Date: Sep 2005
Posts: 558
|
Still unable to get a custom bobber to work. I figured it was because I wasn't calling the autoloading plugins, but that didn't help.
Btw, I found there was still the occasional incorrect frame after decimation. Counting SmartDecimate's output I found this pattern: 12344 1234566 12344 1234566 As a result having TDecimate check cycles of 30, a range not divisible by 12, produces one improper decimation every second. Changing to: TDecimate(Mode=0, Cycle=12, CycleR=2) improved accuracy and produced a serious bump to performance. The pattern seems to hold throughout the video. Now if I can just get the bobber fixed... Last edited by DoctorM; 28th May 2013 at 05:42. |
28th May 2013, 08:25 | #12 | Link | ||
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
Quote:
Quote:
I'm sorry you haven't got the other bobbers to work with SmartDecimate yet. I don't know what other advice to offer. Good luck. |
||
28th May 2013, 20:06 | #13 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
The pattern in your sample is a little convoluted, but appears to repeat. Therefore the Cycle/CycleR in TDecimate works perfectly, if you count the pattern correctly. Here is the field count I came up with, where each digit represents a frame, and 1, 2, and 3 represent the number of fields in each frame in the original video ("2" fields is, of course, what you want for every frame). I viewed this using a script that is nothing more than "separatefields()" :
3-1-3-2-3-2-3-2-3-2-2-2-3-2-3-2-3-2 If you count the number of digits, there are 18 digits, so there are 18 frames. So, after field matching and decimation, we want to end up with 18 frames (36 fields) from these 43 fields. Therefore, out of every 43 fields, we should decimate 7. Code:
AssumeTFF() tfm(display=false,order=-1) tdecimate(display=false,cycleR=7,cycle=43) There is something in the TFM logic that I don't quite understand in how it post-processes the individual fields that have no match. If you set "order=1" TFM will correctly post-process the unmatched odd fields. For these single fields (shown by the "1" in the pattern above) it will give you a frame that contains the original unmatchable field plus a synthesized field, created using whatever technique you choose using the "pp" parameter. However, it skips the even fields. If you instead set "order=0," it then does the even fields but skips the odd fields. So near and yet ... So, the TDecimate logic works great, but the TFM matching and post-processing doesn't quite do the trick. Another approach might be to double the frame rate using a bobber or deinterlacer, and then decimate from that. One final note. I found that the pattern repeats every 43 fields but when I actually walked through the result, putting a separatefields() at the end of the recovered video so I could see what was happening, I found there was still an undecimated result every two cycles. So I doubled Cycle and CycleR and then added one to CycleR in order to remove these remaining duplicates: Code:
AssumeTFF() tfm(display=false,order=1) tdecimate(display=false,cycleR=15,cycle=86) separatefields() Last edited by johnmeyer; 28th May 2013 at 20:10. Reason: added: ("2" fields is, of course, what you want for every frame) |
28th May 2013, 20:14 | #14 | Link | |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
P.S. to my last post. I didn't actually use "MPEG2Source("E:\Test\Test.d2v")" to read the video and perhaps I should. In reading the TFM documentation, there is a parameter that sounds like it might solve the problem:
Quote:
|
|
28th May 2013, 23:16 | #15 | Link | ||
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
Quote:
TFM(Order=1) Even before decimation there are already two missing frames, before frames 30 and 73. TFM just cannot handle this. AssumeTFF() tfm(display=false,order=-1) tdecimate(display=false,cycleR=7,cycle=43) That can't be correct. The final framerate is 25.091 when it should be 24.975fps. You still have the same two 'jumps' plus three duplicate frames. AssumeTFF() tfm(display=false,order=1) tdecimate(display=false,cycleR=15,cycle=86) Nope again, the same two missing frames and the wrong final framerate. Anything that doesn't return 24.975fps is wrong. Quote:
TIVTC isn't optimum for this video. Last edited by manono; 29th May 2013 at 01:31. |
||
28th May 2013, 23:33 | #17 | Link |
Moderator
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
|
It's a learning experience sometimes just to discover how many ways a simple video can be completely messed up by the so-called 'professionals'. There are so many ways to screw up PAL2NTSC when it's so easy just to do it correctly the first time. The mind boggles sometimes because it's then up to us amateurs to try and put things right. I was stumped too, and had tried all sorts of things with TIVTC before giving up, but had had experience with SmartDecimate years ago and decided to give it a try. Maybe there are other and more simple ways to solve this one, but that will have to await the efforts of someone else.
|
29th May 2013, 00:11 | #18 | Link |
Registered User
Join Date: Sep 2005
Posts: 558
|
@johnmeyer - If I read you right, you didn't get TFM to work then? It seems apparent that TFM won't properly process an orphaned field.
Besides, I don't know how I feel about using a 43 frame range. That'll take forever to process. @manono - Fixed my bobber issue. You need to get the bobbing out of the way before SmartDecimate made things awkward. Code:
MPEG2Source("Test.d2v") yada=yadif(mode=1) SmartDecimate(30,60,bob=yada) TDecimate(Mode=0,Cycle=12,CycleR=2) Yet once fully run through the script there are no duplicate frames or apparent missing ones (the movement is smooth). With the 30/5 numbers I did see some duplicates and missing frames in the video 1-2 seconds before the clip I posted (when there was a smaller difference for the frame matcher to detect). |
29th May 2013, 09:09 | #19 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Internally, that code is exactly the same as manono's SmartDecimate(30,60,bob=yadif(mode=1)) Your earlier problem almost certainly has something to do with incompatibilities between the built-in LoadCPlugin() and the older avisynth_c.dll (which declares its own LoadCPlugin() function). I suspect Yadif needs the built-in version while SmartDecimate needs the older one, so the order of loading the dll's becomes important. Hence manono's solution of manually loading the plugins in the appropriate order. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|