VideoHelp Forum
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. Member
    Join Date
    Jun 2020
    Location
    china
    Search Comp PM
    I want to use the following script to browse pictures, pausing for 15 seconds on each picture, but it only reads the first two pictures.

    .
    .
    .
    video = core.bs.VideoSource(source=r'E:\001\%02d.jpg')
    video = core.std.AssumeFPS(video,fpsnum=1, fpsden=15)
    video = haf.ChangeFPS(video, 24000, 1001)
    audio = core.bas.Source(r'E:\audio\xxx.mp3', track=-1)
    audio.set_output(1)
    video.set_output(0)


    This is the script from avisynth, and it works great.

    .
    .
    .
    v = ImageSource("I:\001\%02d.jpg", start=0, end=17, use_DevIL=true)
    v = AssumeFPS(v, 1,16)
    video = ChangeFPS(v, 25,1)
    audio=DirectShowSource("E:\audio\xxx.mp3")
    AudioDub(video,audio)


    Can anyone help me with this problem?
    Quote Quote  
  2. I'd use imwri plugin and python code to create a list of filepaths, it is more versatile and comforting than %xxxd syntax for reading images:
    Code:
    from vapoursynth import core
    from pathlib import Path
    from havsfunc import ChangeFPS
    
    DIRECTORY = r'D:\images'
    IMAGE_DURATION = 15  # seconds
    
    if not hasattr(core, 'imwri'):
        raise AttributeError('vs-imwri plugin is needed to load images: https://github.com/vapoursynth/vs-imwri/releases')
    images = Path(DIRECTORY).glob('IMG_*.JPG')  # loading images into a list using wild cards in image name
    video = core.imwri.Read(filename=list(images))
    video = core.std.AssumeFPS(video, fpsnum=1, fpsden=int(IMAGE_DURATION))
    video = ChangeFPS(video, 24000, 1001)
    audio = core.bas.Source(r'E:\audio\xxx.mp3', track=-1)
    audio.set_output(1)
    video.set_output(0)
    In vapoursynth you have to pipe audio and video separately (preferably using vspipe) to encoders, and only then muxing video and audio. So how to cut audio length to video length would depend how you mux those streams.
    Quote Quote  
  3. so basically you do not have to use audio in vapoursynth, just muxing your audio track to that encoded vapoursynth video stream
    Quote Quote  



Similar Threads

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