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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st May 2023, 23:35   #1  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,636
AutoPath Script Head

# $$$$$$$$$$$ Emulgator's Universal AviSynth AutoPath script head 2023-06-01 $$$$$$$$$$$$$$$$$
# A. Saves you from typing long paths.
# B. Simple auto-increment-renaming of script files will bring you time-saving processing of hundreds of camerafiles
# without having to insert these into something like notepad++, and call multi-line replace, and hope...
# C. Public evaluation of such script has become safer, the script contains no filenames anymore.
# D. Moving source files around is a no-brainer now.
# You just move the source script with them and the script will open the files no matter what path they are in.

# Single files with long paths and filenames
# "C:\MyDocuments\NotMyDocuments\Whatwasthatbytheway\2022-000-00#[Still-unknown-to-me-remnants].MTS"
# Copy this script into source file folder, copy source file name including extension, paste onto script file name.
# Now the example file in folder "C:\MyDocuments\NotMyDocuments\Whatwasthatbytheway"
# has got a script sibling named "2022-000-00#[Still-unknown-to-me-remnants].MTS.avs"
# and you don't have to type the path "C:\MyDocuments\NotMyDocuments\Whatwasthatbytheway" anymore at all.

# Even better: Hundreds of camera files to be processed the same way. Rename to 00000.MTS.avs, preview and edit your master script.
# Then once and for all times: In Windows Explorer you generate 256 copies of 00000.MTS.avs by duplicating 8 times: 1-2-4-8-16-32-64-128-256...
# Sequential Auto-rename to 00000.MTS.avs....00255.MTS.avs.
# You may keep these .avs forever, no matter in which camera folder you will drag them: they will be valid as long as their siblings are there;
# so you move orphaned scripts to a parking folder before batch processing.
# And if .m2ts: you know how to rename extensions. Den4b ReNamer or what you prefer.

# On runtime this script will derive file paths and source filter as follows:
# Calls AviSynth internal string functions to get path and script filename, assuming 2 extensions starting with a dot each.
# Derives number of source extension characters (.ts -> 3, .avi -> 4, .mpeg -> 5) by concluding from the position of the second dot
# Applies these derived arguments to appropriate sourcefilters.

# To edit this script in AvsPmod, associate .avs extension with AvsPmod, doubleclick on .avs script, load preview (press F5) and smile ;-)
# Maybe you will have to match some lines to the actual situation
# You are now ready to append your desired processing.
Code:
#+++++   Start of AutoPath script head  (1 Videostream + 0 or 1 Audiostream)    +++++ 
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("LWLibavVideoSource", 3)
SetFilterMTMode("LWLibavAudioSource", 3)
SetFilterMTMode("DGSource", 3)
scriptextlen=FindStr(RevStr(ScriptFile()),".")
vidextlen=FindStr(RevStr(LeftStr(ScriptFile(),StrLen(ScriptFile())-scriptextlen)),".")
vidfolder=ScriptDir()
audfolder=vidfolder
vidfile=LeftStr(ScriptFile(),(StrLen(ScriptFile())-scriptextlen-vidextlen))
audfile=vidfile
vidext=LeftStr(RightStr(ScriptFile(),scriptextlen+vidextlen),vidextlen)
vidsrc= vidext==".d2v" ? "MPEG2Source" : vidext==".dga" ? "AVCSource" : vidext==".dgi" ? "DGSource" : "LWLibavVideoSource"
audext=vidext==".d2v" ? ".ac3" : vidext==".dgi" ? ".ac3" : vidext
#audext=vidext==".d2v" ? ".dts" : vidext==".dgi" ? ".dts" : vidext
#audext=vidext==".d2v" ? ".wav" : vidext==".dgi" ? ".wav" : vidext
audpid= vidext==".d2v" ? " T80 2_0ch 224Kbps DELAY 0ms" : vidext==".dgi" ? " PID 1100 2.0ch 48KHz 192Kbps DELAY 0ms" :""
#audpid= vidext==".d2v" ? " T81 3_2ch 448Kbps DELAY 0ms" : vidext==".dgi" ? " T81 3_2ch 48KHz 448Kbps DELAY 0ms" :""
audsrc= "LWLibavAudioSource"
Exist(String(vidfolder)+String(vidfile)+String(vidext)) ? Apply(vidsrc,String(vidfolder)+String(vidfile)+String(vidext))\
: Assert(false, "NO SUCH FILE: " + String(vidfolder)+String(vidfile)+String(vidext) + " !")
try {AudioDub(last,Apply(audsrc,String(audfolder)+String(audfile)+String(audpid)+String(audext)))}
catch (err) {last}
# -----   End of AutoPath script head (1 Videostream + 0 or 1 Audiostream)   -----
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 24th July 2023 at 03:38. Reason: Replaced insufficient audio stream test by the more robust try...catch
Emulgator is offline   Reply With Quote
Old 31st May 2023, 23:39   #2  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,636
AudioMerger - AutoPath companion for more audio streams

# Need more audio streams ?
# Append AudioMerger
# Maybe you will have to match some lines to the actual situation.

Code:
# +++++   Start of AudioMerger (1 to 4 additional audio streams)   +++++
audfolder1=audfolder#""
audfolder2=audfolder#""
audfolder3=audfolder#""
audfolder4=""
audfile1=vidfile#""
audfile2=vidfile#""
audfile3=vidfile#""
audfile4=""
audext1=audext
audext2=audext
audext3=".dts"
audext4=""
audpid1=audpid
audpid2=" T81 3_2ch 448Kbps DELAY 0ms"
audpid3=" T8a DELAY 0ms"
audpid4=""
audsrc1="LWLibavAudioSource"
audsrc2="LWLibavAudioSource"
audsrc3="LWLibavAudioSource"
audsrc4="LWLibavAudioSource"
Exist(String(audfolder1)+String(audfile1)+String(audpid1)+String(audext1)) ? MergeChannels(last,Apply(audsrc1,String(audfolder1)+String(audfile1)+String(audpid1)+String(audext1))) : last
Exist(String(audfolder2)+String(audfile2)+String(audpid2)+String(audext2)) ? MergeChannels(last,Apply(audsrc2,String(audfolder2)+String(audfile2)+String(audpid2)+String(audext2))) : last
Exist(String(audfolder3)+String(audfile3)+String(audpid3)+String(audext3)) ? MergeChannels(last,Apply(audsrc3,String(audfolder3)+String(audfile3)+String(audpid3)+String(audext3))) : last
Exist(String(audfolder4)+String(audfile4)+String(audpid4)+String(audext4)) ? MergeChannels(last,Apply(audsrc4,String(audfolder4)+String(audfile4)+String(audpid4)+String(audext4))) : last
# -----   End of AudioMerger (1 to 4 additional audio streams)   -----
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 31st May 2023 at 23:50.
Emulgator is offline   Reply With Quote
Reply

Tags
autopath

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:03.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.