VideoHelp Forum
+ Reply to Thread
Results 1 to 14 of 14
Thread
  1. I have a BFF 1080i source running at 29.97 fps that exhibits an obvious standard telecine pattern of 3:2 (see source)

    Image
    [Attachment 50564 - Click to enlarge]


    However, when running TIVTC using the following script: DGSource("VOB\V02.dgi") AssumeBFF() TFM(slow=2, pp=0) TDecimate() I am left with a video that still displays extreme combing and some sort of blending, on a 3:1 pattern.

    Image
    [Attachment 50566 - Click to enlarge]


    What could be wrong here? I must point out that the m2ts only has one specific scene that is telecine, I'm wondering if the process is failing because the pattern starts on an odd frame or something, but I'm not sure what to do about it. (Also, I'm sorry, but the source being what it is, I cannot upload a safe sample )
    Quote Quote  
  2. You have an interlaced YV12 chroma problem. Do you have any color format conversions in your script? If so make sure you specify "interlaced=true". Maybe the source was encoded incorrectly? Otherwise, a sample is needed.
    Quote Quote  
  3. Hmm, this is what MediaInfo reports for the source

    Code:
    ID : 4113 (0x1011) 
    Menu ID : 1 (0x1) 
    Format : VC-1 
    Format profile : Advanced@L3 
    Codec ID : 234 
    Duration : 27 min 37 s 
    Bit rate : 21.0 Mb/s 
    Width : 1 440 pixels 
    Height : 1 080 pixels 
    Display aspect ratio : 2.000 
    Frame rate : 29.970 (30000/1001) FPS 
    Color space : YUV 
    Chroma subsampling : 4:2:0 
    Bit depth : 8 bits 
    Scan type : Interlaced 
    Scan order : Bottom Field First 
    Compression mode : Lossy 
    Bits/(Pixel*Frame) : 0.451 
    Stream size : 4.06 GiB (95%)
    I am not performing any color conversion. I have posted the full script, which is then encoded with: ffmpeg -i script.avs -hide_banner -loglevel info -y -c:v libx264 -preset slow -crf 21 -tune grain -an "V02@1920x1080.mkv"

    It could be an issue with the source I'll try to get a SFW sample.
    Quote Quote  
  4. Okay, this is SFW https://mega.nz/#!ch5BQICJ!iECHQsQV2ddw1TseuTFut7FKo_2djCMX9jHmRKJBF1A

    Funny thing, I cut this sample using DGIndexNv > Output trimmed TS, and MediaInfo now reports it as TFF instead of BFF?
    Quote Quote  
  5. Step through it viewing the fields after SeparateFields(). You'll see that your fields are corrupted with what looks like chroma ghosting.
    Quote Quote  
  6. Yes, the chroma was screwed up before you got it. I came up with this as a possible fix:

    Code:
    ##########################################################################
    #
    #  Every frame is replaced by a motion interpolated frame from the frame
    #  before and the frame after.
    #
    ##########################################################################
    
    function InterpolateAll(clip c)
    {
        e = SelectEven(c).DoubleFPS2().SelectOdd()
        o = SelectOdd(c).DoubleFPS2().SelectOdd()
        Interleave(e,o)
        Loop(2,0,0)
    }
    
    ##########################################################################
    
    LWLibavVideoSource("D:\Downloads\sample2.m2ts") 
    TFM()
    TDecimate(chroma=false)
    interp = MergeChroma(last, InterpolateAll())
    ConditionalFilter(last, last, interp, "current_frame%4", ">", "0")
    After TFM and TDecimate every 4th frame has the messed up chroma. The code replaces the chroma of those frames with chroma from a motion interpolated frame. There's probably a better way but that was my first idea.
    Quote Quote  
  7. Oddly, I'm lacking the DoubleFPS2 function, and I can't find it anywhere :thinking:

    Is this that one?

    Code:
    function DoubleFPS2(clip source){
    super = MSuper(source, pel=2, hpad=0, vpad=0, rfilter=4)
    backward_1 = MAnalyse(Cnr2(Cnr2(super)), chroma=true, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
    forward_1 = MAnalyse(Cnr2(Cnr2(super)), chroma=true, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
    backward_2 = MRecalculate(super, chroma=true, backward_1, blksize=8, searchparam=1, search=3)
    forward_2 = MRecalculate(super, chroma=true, forward_1, blksize=8, searchparam=1, search=3)
    backward_3 = MRecalculate(super, chroma=true, backward_2, blksize=4, searchparam=0, search=3)
    forward_3 = MRecalculate(super, chroma=true, forward_2, blksize=4, searchparam=0, search=3)
    MBlockFps(source, super, backward_3, forward_3, num=2*FramerateNumerator(source), den=FramerateDenominator(source), mode=0, blend=false)
    }
    Quote Quote  
  8. Unfortunately the result is inconsistent, whenever there's a little too much motion it simple does not work.

    EDIT: Spoke too soon, I had a AssumeBFF() left that messed up the result. It's not perfect but considering the source it's quite acceptable, unless someone comes up with a better solution. Thanks jagabo.
    Quote Quote  
  9. Yes, the code worked ok for this clip but I expected it to mess up when motions got to large. I have a better idea (one that avoids motion interpolation) but not working code yet...
    Quote Quote  
  10. Ok, got it:

    Code:
    LWLibavVideoSource("D:\Downloads\sample2.m2ts") 
    SeparateFields()
    PrevChroma = MergeChroma(last, last.loop(2,0,0)) # replace chroma of each field with the chroma of the field before it
    Interleave(last, PrevChroma) # interleave the two streams so we can easily pick the fields we want
    SelectEvery(20, 1,2,5,6,8,10,12,14,16,18) # pick the good ones
    Weave()
    TFM()
    TDecimate()
    This will fail past any break in the telecine pattern (so will the previous code). If you have breaks you'll need to work in sections.
    Quote Quote  
  11. OK, yeah this produces better results, but I'm afraid I don't understand enough of it to apply the process to different sections properly. The telecine pattern does break in between sections, so I would need to offset it. I suppose it's only about changing the selection pattern in SelectEvery but watching field by field I am unsure how you came to the current pattern. I'm using only this portion

    Code:
    SeparateFields()
    PrevChroma=MergeChroma(last, last.loop(2,0,0))
    Interleave(last, PrevChroma)
    But I'm not sure which fields should be selected just by watching. The pattern I'm seeing is 1,2,3, 5,6, 8,9,10, 12,13,14,15,16,17,18,19,20; after that I don't know which of the duplicates should also be removed, how do you decide? And once I have this, how can I apply it to different Trims?
    Quote Quote  
  12. Originally Posted by ZetaStax View Post
    Code:
    SeparateFields()
    PrevChroma=MergeChroma(last, last.loop(2,0,0))
    Interleave(last, PrevChroma)
    SelectEvery(20, 1,2,5,6,8,10,12,14,16,18)
    But I'm not sure which fields should be selected just by watching.
    Pick one of each pair: 0 or 1, 2 or 3, 4 or 5, 6 or 7... Prefer the even numbered fields when they are good -- because they are the ones with the original luma and chroma.
    Quote Quote  
  13. Alright, for anyone wondering, I ended up splitting the video by finding where the pattern was resetting and IVTC those segments individually. After that I was left with some combing during the fade transitions so I used QTGMC on those segments. Result is quite good, thank you again jagabo for your precious help!

    Code:
    DGSource("VOB\V02.dgi")
    SeparateFields()
    PrevChroma=MergeChroma(last, last.loop(2,0,0))
    Interleave(last, PrevChroma)
    
    
    P1=Trim(0,8431).SelectEvery(20, 1,2, 5,6,8,10,12,14, 16,18).Weave().TFM(pp=0).TDecimate()
    P2=Trim(8432,24423).SelectEvery(20, 1,2, 5,6,8,10,12,14, 16,18).Weave().TFM(pp=0).TDecimate()
    P3=Trim(24424,136751).SelectEvery(20, 1,2, 5,6,8,10,12,14, 16,18).Weave().TFM(pp=0).TDecimate()
    P4=Trim(136752,183303).SelectEvery(20, 1,2, 5,6,8,10,12,14, 16,18).Weave().TFM(pp=0).TDecimate()
    P5=Trim(183304,0).SelectEvery(20, 1,2, 5,6,8,10,12,14, 16,18).Weave().TFM(pp=0).TDecimate()
    P1++P2++P3++P4++P5
    
    PA=Trim(0,1677)
    PB=Trim(1678,1691).QTGMC(preset="Slower", FPSDivisor=2)
    PC=Trim(1691,4878)
    PD=Trim(4879,4893).QTGMC(preset="Slower", FPSDivisor=2)
    PE=Trim(4894,27336)
    PF=Trim(27337,27354).QTGMC(preset="Slower", FPSDivisor=2)
    PG=Trim(27355,36652)
    PH=Trim(36653,36666).QTGMC(preset="Slower", FPSDivisor=2)
    PI=Trim(36667,0)
    PA++PB++PC++PD++PE++PF++PG++PH++PI
    Quote Quote  
  14. For others who might be reading, this "fix" is copying the good chroma of a top field to a bottom field with messed up chroma (or vice versa). It works here because the two fields are from the same film frame. The chroma is slightly displaced vertically (not temporally) but that's better than the blended chroma of the source.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!