hanfrunz
30th September 2010, 14:07
Hello everyone,
would it be possible to write a source filter that autodetects the type of source (using mediainfo and a config file) and then chooses an appropriate source filter via invoke()? And of course you should be able to pass parameters like audio=false etc. That would make batch scripting so much easier.
hanfrunz
EDIT: can a moderator please move it to development?
buzzqw
30th September 2010, 15:30
ffmpegsource is near universal for accessing files...
i think your request is more like a try&try till a working filters is found...
BHH
stax76
30th September 2010, 15:35
Are you sure it's not easier using some GUI? Batch precessing (not to be confused with job processing) is a popular feature in StaxRip so I have some interest in this topic.
Mug Funky
1st October 2010, 07:36
nested use of "try{..} catch {...}"
so first up you try avisource, then qtinput, then mpeg2source, then ffmpegsource, then directshowsource.
or order them by whichever is most convenient.
throw in some ifs to search the file extension if you like "findstr(filename,".mov") > 0? qtinput() : avisource()"
this way you can use the ideal for each format
manolito
1st October 2010, 12:26
MrC does it like this in his AVStoDVD software. Have a look here:
http://forum.doom9.org/showthread.php?p=1215535#post1215535
Cheers
manolito
MrC
3rd October 2010, 20:20
Thanks Manolito to mention it. Please do remember that I am a poor avisynth script writer, so feel free to suggest any improvements. This is the latest update:
# A2DSource library: Universal AviSynth Source Functions
# Written by MrC (November 2008)
# Updated by MrC (July 2010)
# Following AviSynth plugins are required in the same A2DSource folder:
# ffms2.dll more info @ http://code.google.com/p/ffmpegsource
# GetSystemEnv.dll more info @ http://avisynth.org/stickboy
LoadPlugin("ffms2.dll")
LoadPlugin("GetSystemEnv.dll")
LoadPlugin("NicAudio.dll")
Function A2DVideoSource(string VideoSource, string "CacheFolder", bool "DebugVideo", bool "DebugTxt", bool "VFR")
{
CacheFolder = default(CacheFolder, GetSystemEnv("temp"))
DebugVideo = default(DebugVideo, false)
DebugTxt = default(DebugTxt, true)
VFR = default(VFR, false)
Try {
SourceStr = "A2DVideoSource: AVISource"
Video = AVISource(VideoSource, audio = false)
}
Catch(Err_Msg) {
Try {
SourceStr = "A2DVideoSource: DirectShowSource"
Video = DirectShowSource(VideoSource, convertfps = VFR, audio = false)
}
Catch(Err_Msg) {
Try {
SourceStr = "A2DVideoSource: FFmpegSource2 (cache off)"
Video = FFVideoSource(VideoSource, track = -1, cache = false, seekmode = 0)
}
Catch(Err_Msg) {
SourceStr = "A2DVideoSource: FFmpegSource2 (cache on)"
Video = FFVideoSource(VideoSource, track = -1, cachefile = CacheFolder + "\A2DFFV_" + String(Rand()) + ".cache", seekmode = 0)
}
}
}
Video = (DebugVideo == true) ? Subtitle(Video.Info(), SourceStr, font = "courier new", size = 16, align = 1) : Video
Video = (DebugTxt == true) ? Video.WriteFileStart(CacheFolder + "\A2DVideoInfo.cache", """ "FileName: " """, "VideoSource", true) : Video
Video = (DebugTxt == true) ? Video.WriteFileStart(CacheFolder + "\A2DVideoInfo.cache", "SourceStr", "Chr(13)", true) : Video
Return Video
}
Function A2DAudioSource(string AudioSource, string "CacheFolder", bool "DebugTxt", bool "AudioOnly")
{
CacheFolder = default(CacheFolder, GetSystemEnv("temp"))
DebugTxt = default(DebugTxt, true)
AudioOnly = default(AudioOnly, false)
AudioOnly == true ? Eval("""
Try {
SourceStr = "A2DAudioSource: DirectShowSource"
Audio = DirectShowSource(AudioSource, video = false)
}
Catch(Err_Msg) {
Try {
SourceStr = "A2DAudioSource: WAVSource"
Audio = WAVSource(AudioSource)
}
Catch(Err_Msg) {
Try {
SourceStr = "A2DAudioSource: NicDTSSource"
Audio = NicDTSSource(AudioSource)
}
Catch(Err_Msg) {
Try {
SourceStr = "A2DAudioSource: NicAC3Source"
Audio = NicAC3Source(AudioSource)
}
Catch(Err_Msg) {
SourceStr = "A2DAudioSource: NicMPG123Source"
Audio = NicMPG123Source(AudioSource)
}
}
}
}
""") : Eval("""
Try {
SourceStr = "A2DAudioSource: DirectShowSource"
Audio = DirectShowSource(AudioSource, video = false)
}
Catch(Err_Msg) {
Try {
SourceStr = "A2DAudioSource: FFmpegSource2 (cache off)"
Audio = FFAudioSource(AudioSource, track = -1, cache = false)
}
Catch(Err_Msg) {
SourceStr = "A2DAudioSource: FFmpegSource2 (cache on)"
Audio = FFAudioSource(AudioSource, track = -1, cachefile = CacheFolder + "\A2DFFA_" + String(Rand()) + ".cache")
}
}
""")
Audio = (DebugTxt == true) ? Audio.WriteFileStart(CacheFolder + "\A2DAudioInfo.cache", """ "FileName: " """, "AudioSource", true) : Audio
Audio = (DebugTxt == true) ? Audio.WriteFileStart(CacheFolder + "\A2DAudioInfo.cache", "SourceStr", "Chr(13)", true) : Audio
Return Audio
}
;)
Bye
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.