VideoHelp Forum
+ Reply to Thread
Results 1 to 19 of 19
Thread
  1. Member spiritgumm's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    I need to correct horizontal jitter at 50 spots in an interlaced AVI. I'm deinterlacing it, selecting the ranges with Trim to make the cropping correction, but the actual processed video is sometimes off by a frame. I'm using the AvsP gui to create and preview the script, and it will seem fine, but stepping thru it later, some edit points will be off. Doesn't mess up with every edit point. I'm loading the AVI with Directshow, deinterlacing with Qtgmc.Selecteven. Would adding (convertfps=true) to Directshow lock it in?

    The video specs

    General
    Complete name : D:\Video Projects\Episode15.avi
    Format : AVI
    Format/Info : Audio Video Interleave
    Format_Commercial_IfAny : DV
    Format profile : OpenDML
    File size : 22.5 GiB
    Duration : 1h 46mn
    Overall bit rate mode : Constant
    Overall bit rate : 30.3 Mbps

    Video
    ID : 0
    Format : DV
    Codec ID : dvsd
    Codec ID/Hint : Sony
    Duration : 1h 46mn
    Bit rate mode : Constant
    Bit rate : 24.4 Mbps
    Width : 720 pixels
    Height : 480 pixels
    Display aspect ratio : 4:3
    Frame rate mode : Constant
    Frame rate : 29.970 fps
    Standard : NTSC
    Color space : YUV
    Chroma subsampling : 4:1:1
    Bit depth : 8 bits
    Scan type : Interlaced
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 2.357
    Stream size : 21.3 GiB (95%)
    Quote Quote  
  2. DirectShow is not necessarily frame accurate - you can get mixed up frames just seeking

    Use AVISource, or ffms2, or lsmash
    Quote Quote  
  3. Member spiritgumm's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray View Post
    DirectShow is not necessarily frame accurate - you can get mixed up frames just seeking

    Use AVISource, or ffms2, or lsmash
    I had problems loading the script with those earlier, but if I can get one of them to work, are they definitely frame accurate?
    Quote Quote  
  4. Originally Posted by spiritgumm View Post
    Originally Posted by poisondeathray View Post
    DirectShow is not necessarily frame accurate - you can get mixed up frames just seeking

    Use AVISource, or ffms2, or lsmash
    I had problems loading the script with those earlier, but if I can get one of them to work, are they definitely frame accurate?
    Very likely to be frame accurate - for DV source, 99.99% likely...unless source had problems to begin with

    Post a full script - there might be other issues contributing as well
    Quote Quote  
  5. Member spiritgumm's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    ffms2 loaded, so I stepped thru all the edit-trims to make sure they were correct, and am processing in MeGui now.

    Checked some edits and they seem intact, but now the audio drifts further and further out of sync. It was fine with Directshow. In Directshow, I think added "changefps(29.97)" at the end of the QTGMC line because, even though the AVI appears to be 29.97, the new encode was 29.915 fps. However, it might have also made the problems with edit points. The new encode with ffindex (and without the "changefps=29.97") is also 29.915. AvsP isn't reporting these frame rates consistently, or I would have noticed the discrepancy before encoding.



    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\ffms2-2.20-icl\x86\ffms2.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\DGAVCDecode.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\QTGMC Plugins\RemoveGrainSSE2.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\QTGMC Plugins\FFT3DFilter.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\QTGMC Plugins\RepairSSE2.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\QTGMC Plugins\SSE2Tools.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\QTGMC Plugins\mt_masktools-25.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\QTGMC Plugins\mvtools2.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\QTGMC Plugins\EEDI2.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\QTGMC Plugins\nnedi3.dll")
    Import("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\QTGMC Plugins\QTGMC-3.32.avsi")


    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\L-SMASH-Works-20221109\x86\LSMASHSource.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\FillBorders-1.3.0\Release\FillBorders.dll")
    LoadPlugin("C:\Software standalone\DVDware download\AviSynth 25 plugins\plugins\FillMargins\FillMargins.dll")

    ffindex("D:\Video Projects\Episode15.avi")
    a=FFaudioSource("D:\Video Projects\Episode15.avi")
    v=FFvideoSource("D:\Video Projects\Episode15.avi")
    audiodub(a,v)

    QTGMC(preset="fast").selecteven()
    converttoyv12

    main=trim(87,104040) #trim out episode
    buf=BlankClip (main, Length=30) #1 second black at start
    buf+main

    c1=crop(14,2,-14,-4)
    c2=crop(18,2,-10,-4)
    c3=crop(22,2,-6,-4)
    f1=trim(c1,0,483)
    f2=trim(c2,484,793)
    f3=trim(c1,794,1168)
    f4=trim(c2,1169,1840)
    f5=trim(c1,1841,1949)
    f6=Trim(c2,1950,2300)
    f7=trim(c1,2301,2411)
    f8=trim(c2,2412,3312)
    f9=trim(c1,3313,3529)
    f10=trim(c2,3530,6406)
    f11=trim(c1,6407,6457)
    f12=trim(c2,6458,6705)
    f13=trim(c1,6706,7257)
    f14=trim(c2,7258,7438)
    f15=trim(c1,7439,7735)
    f16=trim(c2,7736,15448)
    f17=trim(c1,15449,25210)
    f18=trim(c2,25211,25575)
    f19=trim(c3,25576,26125).fillborders(0,0,4,0,mode= 0)
    f20=trim(c1,26126,26737)
    f21=trim(c2,26738,27060)
    f22=trim(c3,27061,27940).fillborders(0,0,8,0,mode= 0)
    f23=trim(27941,29035).crop(16,2,-12,-4)
    f24=trim(c2,29036,31132)
    f25=trim(c1,31133,31527)
    f26=trim(c2,31528,42991)
    f27=trim(c1,42992,56446)
    f28=trim(56447,57325).crop(20,2,-8,-4)
    f29=trim(c1,57326,57937)
    f30=trim(c2,57938,58348)
    f31=trim(c1,58349,58751)
    f32=trim(c2,58752,59043)
    f33=trim(c1,59044,71806)
    f34=trim(c2,71807,71885)
    f35=trim(c1,71886,75524)
    f36=trim(c2,75525,80628)
    f37=trim(c1,80629,89062)
    f38=trim(c2,89063,93656)
    f39=trim(c1,93657,95960)
    f40=trim(95961,96776).crop(20,2,-8,-4)
    f41=trim(96777,96879).crop(16,2,-12,-4)
    f42=trim(c1,96880,98638)
    #f43=trim(c2,98639,99105)
    f43=trim(c2,98639,99106)
    f44=trim(c3,99107,99328).fillborders(0,0,6,0,mode= 0)
    f45=trim(c2,99329,99576)
    f45a=trim(c3,99577,99786).fillborders(0,0,4,0,mode =0)
    f46=trim(c2,99787,101460)
    f47=trim(c1,101461,102104)
    f48=trim(c2,102105,102434)
    f49=trim(c1,102435,0)
    f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14+f15 +f16+f17+f18+f19+f20+f21+f22+f23+f24+f25+f26+f27+f 28+f29+f30+f31+f32+f33+f34+F35+f36+f37+f38+f39+f40 +f41+f42+f43+f44+f45+f45a+f46+f47+f48+f49

    #GetLeftChannel
    #AmplifydB(10)
    #ResampleAudio(48000)
    Last edited by spiritgumm; 20th Aug 2024 at 19:06.
    Quote Quote  
  6. Try a newer ffms2, because the version you are using is 10 years old.

    When you check with the newer ffms2 version, use info() with just the source filter to see what framerate is returned for the video

    Code:
    a=FFaudioSource("D:\Video Projects\Episode15.avi")
    v=FFvideoSource("D:\Video Projects\Episode15.avi")
    audiodub(a,v)
    info()
    Quote Quote  
  7. Member spiritgumm's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    I can't load any newer version (at least not in my older version of AvsP). The output in FFvideosource can be set for 29.97 fps, although it might be the same as using changefps=29.97.
    Quote Quote  
  8. Personally , I'd update everything . There's got to be hundreds/thousands of bug fixes to avs+ , various plugins accumulated over 10 years

    If you're sticking with old versions, install cedocida for a VFW DV decoder and use AVISource. That's what people used 10-15 years ago for DV.
    Quote Quote  
  9. Member spiritgumm's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    I really didn't want to redo everything just to address this issue, which isn't something that happens in general.
    Adding the "fpsnum=30000, fpsden=1001" ffvideosource to output 29.97 fps resulted in lots of frame dropout, so that was a mistake. Would putting the trim-edits before deinterlacing work?
    Quote Quote  
  10. Originally Posted by spiritgumm View Post
    Would putting the trim-edits before deinterlacing work?

    Unlikely to help if the problem was directshow - and that's the likely culprit for mixed up frames

    Also, if the content is interlaced, then cutting before double rate deinterlacing means coarser edits. Instead of 59.94 samples/s, you get 29.97 samples/s - ie. Instead of 16.7 ms accuracy cuts , you get 33.3 ms "granulation" cuts for both video and audio

    DV (native from a camera) is usually very solid and reliable . Using a buggy ffms2 version or directshow is just shooting yourself in the foot.

    But what is the actual source ? Is it from a DV camera, a capture ?, etc... ? There might be other reasons - maybe your video has problems or is corrupted
    Quote Quote  
  11. Member spiritgumm's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Originally Posted by spiritgumm View Post
    Would putting the trim-edits before deinterlacing work?
    Unlikely to help if the problem was directshow - and that's the likely culprit for mixed up frames

    Also, if the content is interlaced, then cutting before double rate deinterlacing means coarser edits. Instead of 59.94 samples/s, you get 29.97 samples/s - ie. Instead of 16.7 ms accuracy cuts , you get 33.3 ms "granulation" cuts for both video and audio

    DV (native from a camera) is usually very solid and reliable . Using a buggy ffms2 version or directshow is just shooting yourself in the foot.

    But what is the actual source ? Is it from a DV camera, a capture ?, etc... ? There might be other reasons - maybe your video has problems or is corrupted
    I'm probably misunderstanding this, but are you saying I should be editing on 59.94 fps video? I was Deinterlacing with selecteven.

    I was told the video is a capture with Canopus ADVC 300.
    Quote Quote  
  12. If it was interlaced content, I would use 59.94

    If you use QTGMC (without selecteven) and go frame by frame in a scene with motion - is there motion every frame ? If yes, what's the point of discarding 1/2 the data ?

    If the problem was directshow (high probability that is the case), it doesn't matter where you put the edits before/after deinterlacing, and regardless of selecteven - because the problem occurs with directshow
    Quote Quote  
  13. Member spiritgumm's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray View Post
    If it was interlaced content, I would use 59.94

    If you use QTGMC (without selecteven) and go frame by frame in a scene with motion - is there motion every frame ? If yes, what's the point of discarding 1/2 the data ?

    If the problem was directshow (high probability that is the case), it doesn't matter where you put the edits before/after deinterlacing, and regardless of selecteven - because the problem occurs with directshow
    I guess there is motion in every frame, somewhat ghostly. And it's 59.83 fps (double the 29.15 fps, since I removed the 29.97 fps setting in ffvideosource). I'm using the next version of ffms2. These later versions take longer to load in AvsP, if at all. Maybe I could send you a 10 second sample, although the file size might be large.

    I dunno if this is a step backwards, but I took your advice and installed cedocida so Avisource would function. Info() says the video source is 29.97 fps (but so did Directshow, while ffms2 says 29.15). The trim-edit times seem to match up with the Directshow script, whereas using ffms2 will require changing all the edit times. If Avisource is more accurate than Directshow, then it should be fine to use....right? Or is it "maybe"?
    Last edited by spiritgumm; 21st Aug 2024 at 18:34. Reason: info about avisource; correctly spell ffms2
    Quote Quote  
  14. AVISource is frame accurate with DV (assuming your video doesn't have other problems like corruption, errors)

    The framerate for NTSC DV should be 29.97 (or 30000/1001 exactly) . The "weird" fps is from old ffms2 buggy timestamp handling. It should be ok with recent versions of ffms2
    Quote Quote  
  15. Member spiritgumm's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    I've used ffms2 before for AVI from the same source, but I also used "changefps 29.97" after the Deinterlacer because of a fps error when joining different AVI. If the ffms2 is buggy, that might have fixed it enough for my encodes. But if it was, or is, buggy, I wonder why the different AVI had a discrepancy. Seems like they would have all been 29.915 fps.

    So I processed one video with Avisource and it seemed to respect all the edit points, and it's 29.97fps. But the video doesn't seem as smooth as previous encodes with Directshow. I dunno if "changefps 29.97" after the Deinterlacer would have made any difference. It wasn't required here because I wasn't joining different AVI. I imagine the video could be improved by tweaking the QTGMC settings, but that's another headache.
    Last edited by spiritgumm; 23rd Aug 2024 at 17:15.
    Quote Quote  
  16. Originally Posted by spiritgumm View Post
    I've used ffms2 before for AVI from the same source, but I also used "changefps 29.97" after the Deinterlacer because of a fps error when joining different AVI. If the ffms2 is buggy, that might have fixed it enough for my encodes. But if it was, or is, buggy, I wonder why the different AVI had a discrepancy. Seems like they would have all been 29.915 fps.
    They should all be 29.97.

    29.915 is an "off" framerate and likely a problem in earlier processing . It's a "red flag" or warning sign. Perhaps dropped frames, wrong time stamps - look for other problems


    So I processed one video with Avisource and it seemed to respect all the edit points, and it's 29.97fps. But the video doesn't seem as smooth as previous encodes with Directshow. I dunno if "changefps 29.97" after the Deinterlacer would have made any difference. It wasn't required here because I wasn't joining different AVI. I imagine the video could be improved by tweaking the QTGMC settings, but that's another headache.

    AVISource should give the same results in terms of general "smoothness" as Directshow, just more accurate instead of wrong frames compared to DirectShow.

    ChangeFPS(29.97) does nothing if the input is 29.97.

    But if the input is not 29.97, the result should be less smooth because it will drop frames or add duplicate frames to achieve 29.97. There will be slight stuttering or pausing in places
    Quote Quote  
  17. Member spiritgumm's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    Thanks. Could the problem be this particular AVI ? If there was more "movement" in every field than previous AVI videos, would that be more challenging to deinterlace? The source of the AVI were home recorded TV broadcasts on vhs. And whomever digitized this one might have used different settings than used for the older AVI.
    Quote Quote  
  18. Originally Posted by spiritgumm View Post
    Could the problem be this particular AVI ?
    Maybe. But if AVISource is ok, it's probably ok

    FFMS2, especially older versions, are known for buggy timestamps . Usually the frames are decoded correctly, but wrong timestamps, mean an average framerate that is wrong . Often you could fix it with AssumeFPS(30000,1001) . That just fixes all the timestamps , so no frames are dropped or duplicates inserted like ChangeFPS

    If there was more "movement" in every field than previous AVI videos, would that be more challenging to deinterlace?
    Possibly; but that should be unrelated to the "off" framerate

    The source of the AVI were home recorded TV broadcasts on vhs. And whomever digitized this one might have used different settings than used for the older AVI.

    TV broadcasts could be progressive content telecined (e.g. movies, dramas - e.g "23.976p in 29.97i"), or interlaced content (e.g. sports, documentaries, variety shows, news) . There can be mixtures of other content framerates.

    In all cases the NTSC broadcast framerate should be 29.97 (or 30000/1001 exactly) - everything is "packaged" in 29.97i . If you have something 29.915, that suggests a problem somewhere, perhaps dropped frames, timestamp issue
    Quote Quote  
  19. Member spiritgumm's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    It worked out well enough. Thank you very much for all your help!
    Quote Quote  



Similar Threads

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