Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
13th May 2020, 15:30 | #1 | Link |
Registered User
Join Date: Oct 2015
Posts: 97
|
How to use RegEx in avisynth ?
Excuse me i'm newbie in avisynth, Which function used for regex ? I want to get filename in <input> variable which megui provide
When i put the <input> variable into Subtitle function like Code:
Subtitle(<input>) Code:
Subtitle(LoadPlugin("C:\Users\Downloads\Programs\MeGui\tools\ffms\ffms2.dll") FFVideoSource("C:\Users\Downloads\Video\file.mkv", cachefile="C:\Users\Downloads\file.mkv.ffindex", fpsnum=24000, fpsden=1001, threads=1)) Last edited by wthreex; 13th May 2020 at 16:02. |
13th May 2020, 15:54 | #2 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Not sure what you are trying to do here or what regex has to do with it.
Your question would seem to have been better suited for MeGUi thread anyway. but, Quote:
I dont have MeGUI set up at the moment on this machine, but presume you need something like this. Code:
LoadPlugin("C:\Users\Downloads\Programs\MeGui\tools\ffms\ffms2.dll") FFVideoSource("C:\Users\Downloads\Video\file.mkv", cachefile="C:\Users\Downloads\Blinded by the Light 2019.mkv.ffindex", fpsnum=24000, fpsden=1001, threads=1)) add the file path in below where it says <input>. [Just copy and paste it] Code:
Subtitle(<input>) # replace <input> with your subtitle file pathname, eg, Subtitle("D:\mdir\mySub.srt") LoadPlugin line at all, it would be auto loaded for you anyway.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 13th May 2020 at 16:16. |
|
13th May 2020, 16:21 | #3 | Link |
Registered User
Join Date: Oct 2015
Posts: 97
|
Ok I did https://forum.doom9.org/showthread.php?p=1911775
I think i couldn't explain enough, When i open a file in MeGui, There is a variable inside of avisnyth which is "<input>" it will translated to: Code:
Subtitle(LoadPlugin("C:\Users\Downloads\Programs\MeGui\tools\ffms\ffms2.dll") FFVideoSource("C:\Users\Downloads\Video\file.mkv", cachefile="C:\Users\Downloads\file.mkv.ffindex", fpsnum=24000, fpsden=1001, threads=1)) |
13th May 2020, 20:02 | #4 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Well that translation inserting LoadPlugin into Subtitle() is clearly wrong, dont know what MeGUI thinks its doing.
Anyways, I'm sure that the guys in MeGUI thread will sort out what has gone wrong.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 14th May 2020 at 22:43. |
14th May 2020, 08:10 | #6 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Sorry, cant help, I have never used any of the fancy MeGUI stuff, I only ever load final Avs file into it where everythng already
setup exaclty how I want it. I use AutoEncode, and if I do want to add a subtitle I just tick the "Add Additional Content (audio, subs, chapters)" box and add the subtitle. If by 'echo it out' you mean comment it out, then I say yes if you dont want subtitles. EDIT: Your thread title in MP4 encoder forum, "How to get full path of current file as string ?", maybe add the word "MeGUI" somewhere would get more views.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 14th May 2020 at 08:12. |
14th May 2020, 15:31 | #7 | Link |
Registered User
Join Date: Oct 2015
Posts: 97
|
@StainlessS first of all thank you so much to come along with me, In last attempt i recorded my issue: https://streamable.com/cdkk1d i hope it make sense now xD, In video one thing i didnt mention that megui can queue all files in folder and encode them as i mentioned in previous posts ("Select Folder") but the problem is it only pick one script in the queue, So the " get current file path" means the file which megui pick for encode in the queue.
Last edited by wthreex; 14th May 2020 at 15:49. |
15th May 2020, 12:20 | #8 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Hi wthreex,
The thing with the '<input>' stuff is an Avisynth script template, it just allows you to add some avisynth scripting. It might be possible to convert the source file name into a subtitle file eg "D:\myfile.avi' to 'D:\myfile.srt' if you had access to the sourcefile name from within avisynth called via MeGUI, however I am not aware that the source filename is available to avisynth script. Additionally, even if you did have access to the source filename, and hence a similar subtitle filename, all you could do from within avisynth would be to add a 'Hard Coded' subtitle to the video, ie always there and could not switch off subtitle as it is part of the video. I'm guessing that what you want is to be able to auto add eg myfile.srt to the files to be multiplexed together at the final encode stage. I dont think that this is possible, (and the avisynth script template has nothing to do with that type of functionality). I can only suggest that you ask in MeGUI forum if it is possible to auto add an associated subtitle file (eg myfile.srt) to the files to be multiplexed together and the end of encode. [I doubt that this is currently possible, I wish it were otherwise as I would also like to be able auto do that, and for more than a single subtitle file]. EDIT: When I use AutoEncode and want to add multiple subtitle [single subs file can be added quite easily by ticking the 'Add additional content' box], I have to encode normal, and then use the Tools/Muxer/MP4 Muxer tool to mux the separate video, audio and subtitle streams together. EDIT: Similar where multiple audio files require adding to the final encode. [DIrectors commentary, Cast commentary, Video Effects crew commentary etc]
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 15th May 2020 at 12:55. |
15th May 2020, 13:34 | #9 | Link |
Registered User
Join Date: Oct 2015
Posts: 97
|
Yeah, You got my point, Its really annoying me to create a script for each files with same structure just imagine 50 file with 50 srt file i have to create 50 script just manipulate the file path... I created multiple threads around the internet hope it gets somewhere xD
|
15th May 2020, 14:34 | #10 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Maybe take peek at RipBot, dont know if it supports such functionality, but given that Atak_Snajpera goes to great lengths to make a mass production tool, so maybe he has
also provided similar auto add subs type functionality. Some Guides on Videohelp:- https://www.videohelp.com/guides?tools=1039&archive=%25 D9 thread:- https://forum.doom9.org/showthread.php?t=127611 If it does support auto subs, then say so here in thread. thanks.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
15th May 2020, 14:48 | #11 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,421
|
Code:
for n in *.mkv ; do echo "FFVideoSource(\"$n\") > "$n".avs ; done Or do it the manual way and have the list of filepaths in a text file, but use a regex-aware text editor to apply the AviSynth syntax around the paths, including the command to dump each line to an external file. Then run it as either a batch or shell script. All the scripts get generated in less than a second. |
16th May 2020, 02:53 | #12 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
If all of you need is create a bounch of .avs files for your .mkv and .jpg files, you can create a .bat file like this:
FOR %%A IN (*.mkv) DO echo I=ImageSource("%%~dpnA.jpg",end=0) > "%%~nA.avs" FOR %%A IN (*.mkv) DO echo v=FFvideoSource("%%~fA") >> "%%~nA.avs" FOR %%A IN (*.mkv) DO echo v=v.Trim(0,0).ConvertToYV12() >> "%%~nA.avs" FOR %%A IN (*.mkv) DO echo ... The first one create (>) a .avs with the same name than mkv The next lines add (>>) avs lines to the same .avs files
__________________
BeHappy, AviSynth audio transcoder. |
16th May 2020, 10:25 | #13 | Link |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
In staxrip the easiest way would be using macros:
TextSubMod("%source_dir%%source_name%.srt")
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
16th May 2020, 14:09 | #14 | Link |
Registered User
Join Date: Oct 2015
Posts: 97
|
Thanks guys, Some dude in videohelp forum solved my issue https://forum.videohelp.com/threads/...ly#post2583330
@qyot27, @tebasuna51 The problem is if i want to generate avisynth script I have to manaully encode audio, merge , etc ... by my self, Besides the batch encoding only apply one script at the time... @stax76 wish something like that was in Megui... Last edited by wthreex; 16th May 2020 at 14:18. |
16th May 2020, 14:45 | #15 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
@Hello_Hello, that was some real fancy footwork, keeping copy of that Videohelp post, thanks very much.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
16th May 2020, 16:39 | #16 | Link | |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,421
|
Quote:
Code:
for n in *.avs ; do x264 --preset ultrafast --crf 18 -o "${n%.*}.mp4" "$n" ffmpeg -i "$n" -vn -acodec libopus -b:a 192k "${n%.*}.opus" mkvmerge -o "${n%.*}.mkv" "${n%.*}.mp4" "${n%.*}.opus" done Code:
for n in *.avs ; do ffmpeg -i "$n" -vcodec libx264 -preset ultrafast -crf 18 -acodec libopus -b:a 192k "${n%.*}.mkv" done Code:
for n in *.mkv ; do echo "FFVideoSource(\"$n\")" > "${n%.*}.avs" ffmpeg -i "${n%.*}.avs" -vcodec libx264 -preset ultrafast -crf 18 -acodec libopus -b:a 192k "${n%.*}-reencoded.mkv" done |
|
|
|