VideoHelp Forum




+ Reply to Thread
Results 1 to 11 of 11
  1. Hi,

    however the cats, however.

    Please consider this MP4 source:

    https://www.swisstransfer.com/d/361eb4cf-b997-4f2d-a0d1-a2b08311b6ba

    is a variable framerate mp4 source

    that I have put in c:\

    and consider this package that contain 4 files:

    https://www.swisstransfer.com/d/4811dda1-2647-4d8b-9039-2a5d3b6cccd5

    please downaload and locate they in c:\ so you have

    Code:
    c:\VFR .avs
    c:\LSMASHSource.dll
    c:\masktools2.dll
    c:\smoothFPS2.avsi

    Now c:\VFR .avs is:


    Code:
    LoadPlugin("c:\LSMASHSource.dll")
    LoadPlugin("c:\masktools2.dll") 
    
    Import("c:\smoothFPS2.avsi")
    
    vid=LWLibavVideoSource("C:\VFR .mp4")
    aud=LWLibavAudioSource("C:\VFR .mp4",stream_index=1)
    left=GetChannel(aud, 1)
    right=GetChannel(aud, 2)
    both=mergechannels(left, right)
    audiodub(vid, both)
    ConvertAudioTo16Bit()
    
    LancZosResize(1920,1080) 
    
    converttoYV12(interlaced=false)
    
    emask = mt_convolution(vertical="-1 2 -1").ColorYUV(off_y=-64).ColorYUV(gain_y=128).mt_expand(chroma="-128").Blur(0.8)
    Overlay(last, Blur(0.8, 0.8), mask=emask)
    
    
    SmoothFPS2(50000,1000)
    
    assumefps(50)
    
    Prefetch(8)
    I encode this avs to get a video part in 50P, but the audio part extracted using

    Code:
    ffmpeg.exe -y -i  "c:\VFR .avs" -c:a pcm_s16le -ar 48000 out.wav
    seems to have audio in sligh dissync with the video part.

    I wonder if is there a way to adjust the audio wav file usign something like "time stretch" filter or the avisnth script sot that it output an audio part that have the correct sync with video

    thanks
    Quote Quote  
  2. Try:

    Code:
    vid=LWLibavVideoSource("C:\VFR .mp4", fpsnum=30000, fpsden=1000)
    Quote Quote  
  3. why exactly 30000 ?

    mediainfo report tell the source is "29,314 FPS"

    using "my" fps extract subroutine I get the Real FPS is "29.9166666666667"

    However I have to use the line

    Code:
    vid=LWLibavVideoSource("C:\VFR .mp4", fpsnum=30000, fpsden=1000)
    and... it works fine

    I mean: I'm in a batch procedure, in what way I need to get automatically the fpsnum value?
    Quote Quote  
  4. I picked 30000 because MediaInfo reported the "real frame rate" as 30.000. Also, examining the timestamps from ffprobe showed the majority of the durations around 1/30 second. And using that rate showed pretty smooth motion (aside from the jerky camerawork). There are occasional frames with durations around 1/15 second. Those show up as duplicates when you convert to 30 fps CFR.
    Quote Quote  
  5. Umh ok, I don't have an update version of Mediainfo

    however, can FFprobe pick the Real Fps value of 30000/1000 somewere?
    Quote Quote  
  6. Supplying fpsnum and fpsden to LWlibavVideoSource forces it return the constant frame rate specified. VFR frames will be duplicated and/or discarded to match the requested frame rate. If you don't specify a constant frame rate LWlibavVideoSource will return one frame for each frame in the video. It will then use the running time and the number of frames to generate an average frame rate. Audio will be in sync at the start and end -- but if the distribution of frame times is not consistent the audio may be off at other points in the video. If you want to keep the video VFR you have to extract the time codes from the original video, then remux them with the final video. You can't do that here because you are changing the frame rate. There is no longer a 1:1 correspondence between the original time codes and the new frames.

    If you're encoding the output of the specified AVS script you don't need to tell ffmpeg the frame rate. It will get the frame rate from AviSynth.
    Quote Quote  
  7. ok thanks, but another question:

    suppose to have a source like this drone MP4 that is not variable framerate, but have

    framerate : 29,970

    and

    Original frame rate : 29,000

    MediaInfo show:

    Code:
    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4.1
    Format settings, CABAC                   : Si
    Format settings, ReFrames                : 1 frame
    Format settings, GOP                     : M=1, N=29
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 1 min 2s
    Bit rate                                 : 36,2 Mb/s
    Width                                    : 1.920 pixel
    Height                                   : 1.080 pixel
    Display aspect ratio                     : 16:9
    Frame rate mode                          : Costante
    Frame rate                               : 29,970 (30000/1001) FPS
    Original frame rate                      : 29,000 FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bit
    Scan type                                : Progressivo
    Bits/(Pixel*Frame)                       : 0.582
    Stream size                              : 269MiB (100%)
    Encoded date                             : UTC 2022-07-20 20:08:56
    Tagged date                              : UTC 2022-07-20 20:08:56
    in this case what value I need to specify in fpsnum and fpsden?

    Code:
    LWLibavVideoSource("C:\Users\Administrator\Desktop\30fps drone.MP4", fpsnum= , fpsden=  )
    Quote Quote  
  8. You'll probably want to use 30000 and 1001 in that case. But you'll have to test to be sure. I suspect a 29 fps video was sped up to 29.97 fps without reencoding.
    Quote Quote  
  9. https://www.swisstransfer.com/d/01cd3fd4-9f54-4a96-8550-f169048a5bc4

    this is the "30" fps video file, if I don't mystake seems that this is the "30 fps recording mode" of the dji mini 3 drone but if I leave don't inlcude the field fpsnum= , fpsden= what happens?
    Quote Quote  
  10. Since it is CFR 29.97 it plays smoothly at 29.97 fps. If you use fpsnum/fpsden to change it to 29 fps it will be jerky as 1 of every 30 frames will be discarded.
    Quote Quote  
  11. By the way, the occasional duplicates in the earlier video (after converting to CFR, before changing the frame rate to 50p) can be fixed with FillDrops(). See the thread here:

    https://forum.videohelp.com/threads/409885-Every-6th-Frame-is-a-repeat-How-to-Fix#post2695848
    Quote Quote  



Similar Threads

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