VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. The audio is fine in one section of a video which is only a few secs long but the picture is glitchy so I'd rather just erase the picture for that portion. How do I do that?
    Quote Quote  
  2. One way to do it is ApplyRange, and Expr

    You enter the inclusive frame numbers that you want blacked out

    Assuming this is 8bit video, and you want "video black" (Y=16, U=128, V=128) and you want frames 1000-2000 to turn "black"

    Code:
    #source
    ApplyRange(1000, 2000, "expr", "16",  "128", "128")
    Quote Quote  
  3. Thanks. I tried that and it gave this error:

    Script error: Invalid arguments to function "ApplyRange" in line 3

    Here's my script:

    Code:
    LoadPlugin("X:\Portable Installations\MeGUI 2525\tools\ffms\ffms2.dll")
    FFVideoSource("E:\video.mp4", fpsnum=25, fpsden=1, threads=1)  
    ApplyRange(724, 763, "expr", "16",  "128", "128")
    Quote Quote  
  4. Expr requires avisynth+ BTW (expr is very powerful and a critical building block if many of the newer functions, worth upgrading to avs+ for it alone)
    Quote Quote  
  5. Posted my script in previous post just before you posted. Do you have anything that works with normal Avisynth please?
    Quote Quote  
  6. An alternative way if you don't want to use avs+ is just to splice in a blankclip to replace those frames

    Code:
    LoadPlugin("X:\Portable Installations\MeGUI 2525\tools\ffms\ffms2.dll")
    orig=FFVideoSource("E:\video.mp4", fpsnum=25, fpsden=1, threads=1)  
    
    b=blankclip(orig) #makes a blankclip the same characteristics as "orig"
    
    orig.trim(0,723) ++ b.trim(724,763) ++ orig.trim(764,0)
    FFVideoSource does not load audio, so audio is not affected in this example. If audio was loaded, the audio would be blanked out over those frames as well due to blankclip (it also creates blank audio). You would have to use b=AudioDub(b,orig) for the blankclip to replace with original audio
    Quote Quote  
  7. If you want to keep the audio just apply ColorYUV(gain_y=-256, off_y=16, cont_u=-256, cont_v=-256) to the segment you want black.

    Code:
    # load video+audio as "orig" then:
    
    part1 = orig.trim(0,723)
    part2 = orig.trim(724,763).ColorYUV(gain_y=-256, off_y=16, cont_u=-256, cont_v=-256) # cont_u=0 and cont_v=0 are equivalent to GreyScale(), or Tweak(sat=0)
    part3 = orig.trim(764,0)
    
    part1++part2++part3
    Last edited by jagabo; 14th Nov 2022 at 20:11.
    Quote Quote  
  8. Thanks. That worked.
    Quote Quote  
  9. It worked in the preview in AvsPmod but when I encoded the source 1080i 25 fps video with this script it comes out in 720p 59.94 fps despite me NOT adding a downscale or framerate change to the script:

    Code:
    LoadPlugin("X:\Portable Installations\MeGUI 2525\tools\ffms\ffms2.dll")
    orig=FFVideoSource("E:\video.mp4", fpsnum=25, fpsden=1, threads=1)  
    b=blankclip(orig)
    orig.trim(0,723) ++ b.trim(724,763) ++ orig.trim(764,0) 
    AssumeTFF() 
    Yadif(mode=1, order=1)
    Quote Quote  
  10. Maybe you mixed up scripts or forgot to save it before encoding ? Or messed up the encoding settings ?
    Quote Quote  
  11. Not sure what happened but I tried to encode it again and it encoded properly this time. Thanks
    Quote Quote  
  12. BTW, there are other ways to cover up mistakes or technical glitches. The pros do it with B-roll, which is video of surrounding areas or something related to the event, but not of the thing currently being photographed.

    As a variation on this idea you can sometimes repeat a portion of a scene take much earlier or later, so the viewer isn't confused.

    If you have anything you have cut, perhaps it is good enough to use as a cover shot.

    Depending on the length of the gap, you can sometimes slow down adjacent clips, as long as someone's lips don't have to be synced to the sound. I did this for a ballet performance I streamed where the video glitched for 3-5 seconds. The dancers slowed down a a bit, but it looked pretty natural, and it didn't take you completely out of the experience of watching the performance, as a blank screen would certainly do.

    If you have one or two good frames in the middle of the noise and garbage, take a snapshot of that frame and freeze on it. If you have several good frames, use each one of them for the appropriate amount of time.

    All of this is much easier to do in your NLE than it is in AVISynth.

    Bottom line: a black frame is very distracting and I would advise against doing that unless none of the options above will work.
    Quote Quote  



Similar Threads

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