VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. Hello there, I have bunch of files in a folder and i do encode them with batch processing (one click encoder) in MeGui

    My question is how do i get the path of current file involve in the queue as string dynamically for avisynth usage? I mean this section:



    As you can see i hardcoded the path of file in the avisynth script, But the problem is if i use batch processing it throws error in avisynth because of harcoded path

    I know there is a <input> variabale inside of avisynth pane, But my script need the path of file as a string, I'm looking for some variable/method in the megui or avisynth to give me current file path, is it possible?
    Quote Quote  
  2. Not being able to see your whole script, I'm not sure, but is there a reason for including the audio in the same script? Normally MeGUI extracts the audio or creates it's own script to encode it, and while I can see the Trim line, unless you're editing, you should be able to let MeGUI work the way it normally does. If you want to create variables in templates that won't be audio, you could use "last".

    <input>
    VID = last.ConvertToYV12()
    IMG = ImageSource("D:\Something.jpg")

    And then do whatever you're doing from there, only without the audio.

    Maybe another option would be to create the scripts for opening the source files yourself, and use those scripts along with your AVS template as the input files for batch encoding. MeGUI would use Import() to load the scripts you create as the source, and you should be able to include the audio that way if you need to. Obviously it's not as automated though, but you should be able to create a script combining FFVideoSource and FFAudioSource for each source file, and I'm pretty sure if the source isn't already indexed, it'll happen as the OneClick encoder runs each job in the queue, so you shouldn't have to index first.

    By the way, for ffms2, this combines the video and audio for you so you don't need to use AudioDub.

    FFMS2("D:\Viideo.mkv", atrack=-1)

    The default is atrack=-2, which is no audio.
    atrack=-1 means the first audio stream.
    Last edited by hello_hello; 15th May 2020 at 11:58.
    Quote Quote  
  3. Originally Posted by hello_hello View Post
    If you want to create variables in templates that won't be audio, you could use "last".

    VID = last.ConvertToYV12()
    IMG = ImageSource("D:\Something.jpg")
    One thing, As my images has the same name of the current file, Can it be cast to string? Look like it return resource of the file instead of the path as string, I mean this part

    Code:
    Path = last.ConvertToYV12().toString   // some method like toString that give me the path like: "D:\FullPathOfCurrentFileWithExtension"
    
    IMG = Path (with some str replace function to replace mp4 to jpg becuase the image always have the same name in my case
    Last edited by untymage; 15th May 2020 at 12:29.
    Quote Quote  
  4. While I was at it I extracted the file name and cachefile so you can include audio if you want to. Whether you use FFMS2 or FFVideoSource for the last line, it's probably a good idea to use one of them as they don't include the fps stuff MeGUI adds to the script for FFVideoSource. It can cause dropped and duplicate frames when the source is already a constant frame rate and should only be used to convert a variable frame rate source.
    If you use FFMS2 for the final line with audio enabled, I guess MeGUI will index when it opens the source, then when the script runs it'll have to be indexed again.

    This is the input string I was using for testing.

    LoadPlugin("C:\Program Files\MeGUI\tools\ffms\ffms2.dll")
    FFVideoSource("E:\Video.mkv", cachefile="D:\Video.mkv.ffindex", fpsnum=25, fpsden=1)

    The string functions:
    http://avisynth.nl/index.php/Internal_functions#String_functions

    Code:
    <input>
    V = last
    InputString = """<input>"""
    
    No1 = FindStr(InputString, "FFVideoSource") + 15
    No2 = FindStr(InputString, "cachefile")
    No3 = FindStr(InputString, "ffindex")
    Image = MidStr(InputString, No1, No2-No1-6) + "jpg"
    File = MidStr(InputString, No1, No2-No1-3)
    CFile = MidStr(InputString, No2+11, No3-No2-4)
    
    V.Subtitle(Image) # test
    # V.Subtitle(File) # test
    # V.Subtitle(CFile) # test
    
    # IMG = ImageSource(Image)
    # VID = FFMS2(File, cachefile=CFile, atrack=-1)
    # VID = FFVideoSource(File, cachefile=CFile)
    Last edited by hello_hello; 16th May 2020 at 08:10.
    Quote Quote  
  5. It worked! That's exactly what I've been looking for a week, Thank you!
    Quote Quote  
  6. You're welcome.

    In case you missed it, I edited the post to make a change because I was using "fps" as a location point in the string, which seemed a little silly (in case it's not always there), so I changed it to "ffindex" instead.
    Quote Quote  



Similar Threads

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