VideoHelp Forum
+ Reply to Thread
Page 2 of 3
FirstFirst 1 2 3 LastLast
Results 31 to 60 of 64
Thread
  1. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Originally Posted by jagabo View Post
    Remember you can return the state of processing or any stream at some intermediate point in the script to check the filtering:

    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    SetFilterMTMode("QTGMC", 2)
    v = AVISource("F:\Video Clip.avi")
    vid1 = v.trim(0,119200).AssumeTFF().AssumeFPS(25).QTGMC(preset="Slow", matchpreset="Slow", matchpreset2="Slow", sourcematch=3, Lossless=2, TR2=2, EdiThreads=2, border=true)
    vid2 = v.trim(119201,120637).AssumeTFF().AssumeFPS(25).TFM(pp=0).ChangeFPS(50)
    vid3 = v.trim(120638,132580).AssumeTFF().AssumeFPS(25).QTGMC(preset="Slow", matchpreset="Slow", matchpreset2="Slow", sourcematch=3, Lossless=2, TR2=2, EdiThreads=2, border=true)
    vid1 ++ vid2 ++ vid3
    return(vid1) # or vid2, vid3, or last (the output of vid1++vid2++vid3)
    Trim(0,132580)
    Prefetch(5)
    Well that's interesting! return(vid1) plays as normal, but vid2 and vid3 just displays the last frame of the video, so that explains the silence.. as that last frame that plays for another 44 minutes is mute. Very strange.

    Originally Posted by poisondeathray View Post
    for yadifmod2 you need to specify the actual arguments - it would be yadifmod2(order=1, mode=1) because the arguments are in different position (yadif is mode, order; but yadifmod2 is order, field, mode) . So yadifmod2(1,1) is actually order=1,field=1,mode=0 , which is single rate

    Check each of vid1, vid2 and vid3 individually, and separately as jagabo suggested. I think you're mixing up frame numbers

    What is the fps and framecount of "Video clip.avi" as read by AVISource ?

    AVISource("F:\Video Clip.avi")
    info()
    Ah i see, that's sorted it now. Playing back in MPC-HC sync is fine, still goes mute at the moment TFM was applied and stays like that, as before.
    Quote Quote  
  2. If you play

    AVISource("F:\Video Clip.avi")
    TFM()

    Is it "mute?"


    Something is wrong with your vid2 and vid3, perhaps the frame number references, or the video itself - maybe seek problems with AVISource . What kind of AVI is it ? What does mediainfo say about it ?

    (And a 10x speedup for AVS classic MT x86 , vs. AVS+ MT x64 is "not typical" ; likely there were other issues, such as memory bottlenecks, caching, page file . In the absence of bottlenecks you might expect ~20-50% faster . Still faster, but not 1000% faster)
    Quote Quote  
  3. My guess is he derived the trim values looking at a QTGMC'd version of the video (which has twice as many frames). But the trims are made on the source video. So all the trims after the first are beyond the end of the source video. Hence the single frame, the last frame of the video. That is why I asked how many frames there are in v.
    Quote Quote  
  4. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Originally Posted by poisondeathray View Post
    If you play

    AVISource("F:\Video Clip.avi")
    TFM()

    Is it "mute?"


    Something is wrong with your vid2 and vid3, perhaps the frame number references, or the video itself - maybe seek problems with AVISource . What kind of AVI is it ? What does mediainfo say about it ?

    (And a 10x speedup for AVS classic MT x86 , vs. AVS+ MT x64 is "not typical" ; likely there were other issues, such as memory bottlenecks, caching, page file . In the absence of bottlenecks you might expect ~20-50% faster . Still faster, but not 1000% faster)
    It's not mute, but the sound is failing to keep up with the video, going very stuttery, almost like it might be a problem with the video itself. The original source is MP4 but i converted it to Lagarith Lossless AVI in Virtualdub to get the video to load properly in Avisynth. Though it always renders and plays fine with just QTGMC on, but still had to trim out the frozen frame problem at the end. Perhaps i'd get better results without decompressing the video and loading the original MP4, i just got used to using AVISource i guess, as it seemed easier to work with. Having played the AVI file back it plays twice as fast whilst the sound plays normal before the video stops midway through and sound continues.. so that's what has been causing all the issues i think.

    Tried loading the original MP4 using LSmash, and no more end of frame problem, the video ends where it should, but all sound is mute now. How do i enable the audio?

    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    v = LSMASHVideoSource("F:\HDD\New Volume\150914-2138.mp4")
    LSMASHAudioSource("F:\HDD\New Volume\150914-2138.mp4")
    vid1 = v.trim(0,119200).AssumeTFF().AssumeFPS(25).yadifmod2(order=1, mode=1) 
    vid2 = v.trim(119201,120637).AssumeTFF().AssumeFPS(25).TFM(pp=0).ChangeFPS(50)
    vid3 = v.trim(120638,132580).AssumeTFF().AssumeFPS(25).yadifmod2(order=1, mode=1) 
    vid1 ++ vid2 ++ vid3
    Prefetch(5)
    Quote Quote  
  5. You can use AudioDub()

    eg.
    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    vid = LSMASHVideoSource("F:\HDD\New Volume\150914-2138.mp4")
    aud = LSMASHAudioSource("F:\HDD\New Volume\150914-2138.mp4")
    v = AudioDub(vid,aud)
    vid1 = v.trim(0,119200).AssumeTFF().AssumeFPS(25).yadifmod2(order=1, mode=1) 
    vid2 = v.trim(119201,120637).AssumeTFF().AssumeFPS(25).TFM(pp=0).ChangeFPS(50)
    vid3 = v.trim(120638,132580).AssumeTFF().AssumeFPS(25).yadifmod2(order=1, mode=1) 
    vid1 ++ vid2 ++ vid3
    Prefetch(5)
    Quote Quote  
  6. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Originally Posted by poisondeathray View Post
    You can use AudioDub()

    eg.
    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    vid = LSMASHVideoSource("F:\HDD\New Volume\150914-2138.mp4")
    aud = LSMASHAudioSource("F:\HDD\New Volume\150914-2138.mp4")
    v = AudioDub(vid,aud)
    vid1 = v.trim(0,119200).AssumeTFF().AssumeFPS(25).yadifmod2(order=1, mode=1) 
    vid2 = v.trim(119201,120637).AssumeTFF().AssumeFPS(25).TFM(pp=0).ChangeFPS(50)
    vid3 = v.trim(120638,132580).AssumeTFF().AssumeFPS(25).yadifmod2(order=1, mode=1) 
    vid1 ++ vid2 ++ vid3
    Prefetch(5)
    Playing it back, but sound is going out of sync.
    Quote Quote  
  7. Does original go out of sync ? Ignore what it looks like

    Code:
    vid = LSMASHVideoSource("F:\HDD\New Volume\150914-2138.mp4")
    aud = LSMASHAudioSource("F:\HDD\New Volume\150914-2138.mp4")
    AudioDub(vid,aud)
    Quote Quote  
  8. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    The video is playing very speedy now, but sound is playing at normal speed.
    Quote Quote  
  9. We already know that LSMASHVideoSource() misinterprets the field rate as the frame rate. Just add .AssumeFPS(25) at the end of the first line.
    Quote Quote  
  10. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Originally Posted by jagabo View Post
    We already know that LSMASHVideoSource() misinterprets the field rate as the frame rate. Just add .AssumeFPS(25) at the end of the first line.
    Thanks, playing normally now. I'll render it all and see how it turns out.
    Quote Quote  
  11. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    The video rendered all 44 minutes, but then just froze on the batch file, so never finalised itself, thus no encoded file at the end.
    Quote Quote  
  12. I don't know why your encoding locked up but... 44 minutes at 25 fps is 66000 frames. As I suspected, your trim numbers are all wrong.
    Quote Quote  
  13. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Your right, i'll need to amend the trims, as AvsPmod is now reporting 265162 frames.
    Quote Quote  
  14. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Well the encode keeps freezing up at frame 133293, which i assume is the maximum number of frames of the video (accounting for becoming 50 progressive frames to emulate the smooth playback of simultaneous interlaced fields) No idea were to put the trims to apply the TFM, as it corresponds far beyond the number of frames in the AvsPmod preview, about frame 238180.

    Curiously AvsPmod reports it being 1 hour and 28 minutes long, when the video is only 44 minutes long.
    Last edited by Master Tape; 22nd Jan 2020 at 10:38.
    Quote Quote  
  15. Is the original video ok as decoded by Lsmash? Check return v . Seek in mpchc or avspmod. Check the framecount

    Code:
    vid = LSMASHVideoSource("F:\HDD\New Volume\150914-2138.mp4").AssumeFPS(25)
    aud = LSMASHAudioSource("F:\HDD\New Volume\150914-2138.mp4")
    AudioDub(vid,aud)
    Are you using current lsmash version ? some older versions might have problems
    https://github.com/HolyWu/L-SMASH-Works/releases


    You can see the frame numbers in avspmod in the status bar (current and total). Check each part individually for framecount. Seek to each part individually. You don't have to waste time encoding anything (preview in avspmod or mpchc) . If the script is ok, then maybe something else is wrong like the encoder (I doubt it)

    Do a new set of trims. Add the Trims afterwards @50fps so you know exactly what you're getting

    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    vid = LSMASHVideoSource("F:\HDD\New Volume\150914-2138.mp4").AssumeFPS(25)
    aud = LSMASHAudioSource("F:\HDD\New Volume\150914-2138.mp4")
    v = AudioDub(vid,aud)
    vid1 = v.yadifmod2(order=1, mode=1) 
    vid2 = v.TFM(pp=0).ChangeFPS(50)
    vid1.trim(start1,end1) ++ vid2.trim(start2,end2) ++ vid3.trim(start3,end3)
    Prefetch(5)
    "vid1" is double rate deinterlaced version .
    "vid2" is a TFM version then duplicated frames .

    use return vid1 to get the reference frame numbers for your trims for start1,end1 , start3, end3 (replace those with the actual values)
    use return vid2 to get the reference frame numbers for your trims for start2,end2 (replace those with the actual values)

    If it's ok in avspmod or mpchc, change yadifmod2 with qtgmc and encode
    Quote Quote  
  16. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Originally Posted by poisondeathray View Post
    Is the original video ok as decoded by Lsmash? Check return v . Seek in mpchc or avspmod. Check the framecount

    Code:
    vid = LSMASHVideoSource("F:\HDD\New Volume\150914-2138.mp4").AssumeFPS(25)
    aud = LSMASHAudioSource("F:\HDD\New Volume\150914-2138.mp4")
    AudioDub(vid,aud)
    Total framecount is 13305.

    Are you using current lsmash version ? some older versions might have problems
    https://github.com/HolyWu/L-SMASH-Works/releases
    Have updated to most recent version.

    You can see the frame numbers in avspmod in the status bar (current and total). Check each part individually for framecount. Seek to each part individually. You don't have to waste time encoding anything (preview in avspmod or mpchc) . If the script is ok, then maybe something else is wrong like the encoder (I doubt it)

    Do a new set of trims. Add the Trims afterwards @50fps so you know exactly what you're getting

    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    vid = LSMASHVideoSource("F:\HDD\New Volume\150914-2138.mp4").AssumeFPS(25)
    aud = LSMASHAudioSource("F:\HDD\New Volume\150914-2138.mp4")
    v = AudioDub(vid,aud)
    vid1 = v.yadifmod2(order=1, mode=1) 
    vid2 = v.TFM(pp=0).ChangeFPS(50)
    vid1.trim(start1,end1) ++ vid2.trim(start2,end2) ++ vid3.trim(start3,end3)
    Prefetch(5)
    "vid1" is double rate deinterlaced version .
    "vid2" is a TFM version then duplicated frames .

    use return vid1 to get the reference frame numbers for your trims for start1,end1 , start3, end3 (replace those with the actual values)
    use return vid2 to get the reference frame numbers for your trims for start2,end2 (replace those with the actual values)

    If it's ok in avspmod or mpchc, change yadifmod2 with qtgmc and encode
    Ok used "vid1" then "vid2" to note the reference frames, then added them via the trims. But now getting a "I don't know what "vid3" means" error.

    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    vid = LSMASHVideoSource("F:\HDD\New Volume\150914-2138.mp4").AssumeFPS(25)
    aud = LSMASHAudioSource("F:\HDD\New Volume\150914-2138.mp4")
    v = AudioDub(vid,aud)
    vid1 = v.yadifmod2(order=1, mode=1) 
    vid2 = v.TFM(pp=0).ChangeFPS(50)
    vid1.trim(0,237937) ++ vid2.trim(238285,240660) ++ vid3.trim(240710,264590)
    Prefetch(5)
    Shouldn't it be vid1, vid2 then back to vid1 in the trims? Since there's no vid3 in the initial deinterlaced lines.
    Quote Quote  
  17. Yes,
    vid1.trim(0,237937) ++ vid2.trim(238285,240660) ++ vid1.trim(240710,264590)
    Quote Quote  
  18. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Video is out of sync with audio. There must be some sort of glitch being caused somehow. The audio plays for it's actual duration, but somehow the video plays for 1 hour 28 minutes, without looking too abnormal. Very odd.
    Quote Quote  
  19. Is that with QTGMC ? or yadifmod2 ? Slow hardware can cause the preview to go out of sync, but if script is ok, encode should be ok

    what about vid1 and vid2 each separately ? out of sync ? What about with each with the trims ?
    Quote Quote  
  20. Originally Posted by Master Tape View Post
    Originally Posted by poisondeathray View Post
    Is the original video ok as decoded by Lsmash? Check return v . Seek in mpchc or avspmod. Check the framecount

    Code:
    vid = LSMASHVideoSource("F:\HDD\New Volume\150914-2138.mp4").AssumeFPS(25)
    aud = LSMASHAudioSource("F:\HDD\New Volume\150914-2138.mp4")
    AudioDub(vid,aud)
    Total framecount is 13305.
    Typo ? 13305 frames @ 25 FPS would be 8 minutes +

    Was that mp4 the original , original source? What does mediainfo (view=>text) say about it ?
    Quote Quote  
  21. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Originally Posted by poisondeathray View Post
    Is that with QTGMC ? or yadifmod2 ? Slow hardware can cause the preview to go out of sync, but if script is ok, encode should be ok

    what about vid1 and vid2 each separately ? out of sync ? What about with each with the trims ?
    I think it's a problem with LSMASH, switched back to AVISource and it came out fine. Now i remember why i stopped using LSMASH in the first place, it never plays nice with Avisynth, more trouble than it's worth.
    Quote Quote  
  22. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Ok here's a new one.. A new video i'm working on has a presenter infront of a CGI background (green screen) and the background shimmers like mad when i apply QTGMC of course. I've tried TFM(pp=0) and then apply ChangeFPS(50) whilst this gets rid of the shimmer, the presenter isn't in full smooth motion, you get with 50 frames. How can you deal with an image that both has an interlaced and progressive source? without having to compromise one over the other?
    Quote Quote  
  23. Normally QTGMC() deals with that. I need a sample of the source video to see what's going on.
    Quote Quote  
  24. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Here's the sample.
    Image Attached Files
    Quote Quote  
  25. The background in that video has already been deinterlaced with a duplicate-field algorithm (or was just created that way). That is, the CGI background is really a 720x288 image doubled in height with a point resize. If you watched it on an interlaced TV it would bounce up and down like that too. So QTGMC is essentially duplicating what you would see on a CRT. Off the top of my head -- you might overlay a simple frame dup with a QTGMC where there are comb artifacts. I'll have to think about other fixes...

    <edit>
    Basicall, I just overlaid QTGMC where there is motion between frames. There's also something screwy with the chroma, hence the PointResize and nnedi3:

    Code:
    ##########################################################################
    #
    # Abs(v1-v2)
    #
    # Y channel only
    # Works for YUV only
    #
    ##########################################################################
    
    function AbsSubtract(clip v1, clip v2)
    {
        Subtract(v1, v2).ColorYUV(off_y=2)
        Overlay(last.ColorYUV(off_y=-128), last.Invert().ColorYUV(off_y=-127), mode="add")
    }
    
    ##########################################################################
    
    Mpeg2Source("VTS_01_2.demuxed.d2v", CPU2="ooooxx", Info=3) 
    
    # mask of areas where there's motion between frames:
    diff = AbsSubtract(last, Trim(1,0)).mt_binarize(10).mt_expand(chroma="-128").Blur(1.0).SelectEvery(1,0,0)
    
    # double frame rate by duplication of one field
    dup = PointResize(width, height/2).nnedi3(dh=true).SelectEvery(1,0,0)
    
    # overlay QTGMC where there's motion
    Overlay(dup, QTGMC(), mask=diff)
    There's a little extra buzzing on some sharp horizontal edges. You can fiddle with dup code to clean that up.

    </edit>
    Image Attached Files
    Last edited by jagabo; 2nd Sep 2020 at 18:44.
    Quote Quote  
  26. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Thanks jag. Though i'm getting Invalid arguments to function Trim.
    Quote Quote  
  27. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM


    ..
    Quote Quote  
  28. My guess is "last" is undefined at that point in the script (as with all functions, Trim() assumes last if a named stream isn't specified). Post your entire script.
    Quote Quote  
  29. Member
    Join Date
    Aug 2013
    Location
    Scotland
    Search PM
    Code:
    ##########################################################################
    #
    # Abs(v1-v2)
    #
    # Y channel only
    # Works for YUV only
    #
    ##########################################################################
    
    function AbsSubtract(clip v1, clip v2)
    {
        Subtract(v1, v2).ColorYUV(off_y=2)
        Overlay(last.ColorYUV(off_y=-128), last.Invert().ColorYUV(off_y=-127), mode="add")
    }
    
    ##########################################################################
    
    vid = Mpeg2Source("F:\A Video Files\DVD Rips\Video.d2v", CPU2="ooooxx", Info=3) 
    
    # mask of areas where there's motion between frames:
    diff = AbsSubtract(last, Trim(1,0)).mt_binarize(10).mt_expand(chroma="-128").Blur(1.0).SelectEvery(1,0,0)
    
    # double frame rate by duplication of one field
    dup = PointResize(width, height/2).nnedi3(dh=true).SelectEvery(1,0,0)
    
    # overlay QTGMC where there's motion
    Overlay(dup, QTGMC(), mask=diff)
    aud = FFAudioSource("F:\A Video Files\DVD Rips\Audio.mp2")
    AudioDub(vid, aud)
    DelayAudio(-0.192)
    Crop(0,0,-6,-4)
    Trim(34888,35555)
    Quote Quote  
  30. As I suspected your source is named vid, not last. And later you are implicitly using an undefined last, tossing out the filtered video and reverting to the original input. One way to fix the script is:

    Code:
    ##########################################################################
    #
    # Abs(v1-v2)
    #
    # Y channel only
    # Works for YUV only
    #
    ##########################################################################
    
    function AbsSubtract(clip v1, clip v2)
    {
        Subtract(v1, v2).ColorYUV(off_y=2)
        Overlay(last.ColorYUV(off_y=-128), last.Invert().ColorYUV(off_y=-127), mode="add")
    }
    
    ##########################################################################
    
    # note: vid= is gone
    Mpeg2Source("F:\A Video Files\DVD Rips\Video.d2v", CPU2="ooooxx", Info=3) 
    # the input video is now implicitly named last
    
    # mask of areas where there's motion between frames:
    diff = AbsSubtract(last, Trim(1,0)).mt_binarize(10).mt_expand(chroma="-128").Blur(1.0).SelectEvery(1,0,0)
    
    # double frame rate by duplication of one field
    dup = PointResize(width, height/2).nnedi3(dh=true).SelectEvery(1,0,0)
    
    # overlay QTGMC where there's motion
    Overlay(dup, QTGMC(), mask=diff)
    
    aud = FFAudioSource("F:\A Video Files\DVD Rips\Audio.mp2")
    AudioDub(last, aud)
    DelayAudio(-0.192)
    Crop(0,0,-6,-4)
    Trim(34888,35555)
    Remember, whenever you don't specify an input or output name -- the name "last" is assumed. So:

    Code:
    Mpeg2Source("F:\A Video Files\DVD Rips\Video.d2v", CPU2="ooooxx", Info=3) 
    diff = AbsSubtract(last, Trim(1,0)).mt_binarize(10).mt_expand(chroma="-128").Blur(1.0).SelectEvery(1,0,0)
    is the same as:

    Code:
    last = Mpeg2Source("F:\A Video Files\DVD Rips\Video.d2v", CPU2="ooooxx", Info=3) 
    diff = AbsSubtract(last, last.Trim(1,0)).mt_binarize(10).mt_expand(chroma="-128").Blur(1.0).SelectEvery(1,0,0)
    Quote Quote  



Similar Threads

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