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?
+ Reply to Thread
Results 1 to 6 of 6
-
-
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.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
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.
-
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.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
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.Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview)
Similar Threads
-
How to set ffmpeg File Path on Batch File
By Daringbaaz in forum Newbie / General discussionsReplies: 2Last Post: 28th Jul 2019, 05:55 -
Current PAL/NTSC DVD Conversion Guide? Current Guides are outdated
By isj209h23h in forum User guidesReplies: 3Last Post: 20th Jul 2018, 21:53 -
MeGUI has Stopped working (after starting Queue)
By digiraiter in forum Video ConversionReplies: 3Last Post: 2nd May 2018, 21:12 -
FFmpeg Subtitle not taking sub.ass file path
By shahid109 in forum SubtitleReplies: 7Last Post: 12th Jun 2017, 23:36 -
cannot copy (file=x) the path is too deep
By djtrixx in forum Newbie / General discussionsReplies: 3Last Post: 5th Feb 2016, 09:40