PDA

View Full Version : Good solution: implementing generalised VFAPISource(type, filename)


LigH
25th October 2002, 19:42
Hi everyone: While searching for support for QuickTime files as input type for AviSynth, I found a nice page in Japanese, where I could find an AviSynth snippet which implements a generalised function to load AviUtl, DVD2AVI, TMPGEnc, MPEG2 Video, QuickTime 4.0+, and CSTR files or projects:

http://mjpeg1.virtualave.net/avisynth/
http://mjpeg1.virtualave.net/avisynth/vfapi.avs

Unfortunately, this file is not absolutely correct, e.g. there is at least one letter missing, therefore I'll post it here completely:

vfapi.avs:
#######################
# VFAPI Plugin #
# Import("vfapi.avs") #
#######################
#
# Based on
# http://mjpeg1.virtualave.net/avisynth/vfapi.avs
# (slightly edited by *LigH*
#
# Find more information at
# http://mjpeg1.virtualave.net/avisynth/

# AviUtl
global aup_dir = "?:\*\AviUtl"

# TMPGEnc
global tpr_dir = "?:\*\TMPG"

# DVD2AVI
global d2v_dir = "?:\*\DVD2AVI"

# MPEG2 VIDEO VFAPI Plugin
global m2v_dir = "?:\*\TMPG"

# QuickTime 4.0 VFPAPI Plugin
global mov_dir = "?:\*\TMPG"

# CSTR
global str_dir = "?:\*\TMPG"

########################################
# VFAPISource function #
# #
# AviUtl (.aup) #
# VFAPISource("AUP","path\foo.aup") #
# #
# DVD2AVI #
# VFAPISource("D2V","path\foo.d2v") #
# #
# TMPGEnc #
# VFAPISource("TPR","path\foo.tpr") #
# #
# MPEG2 VIDEO VFAPI Plugin #
# VFAPISource("M2V","path\foo.vob") #
# #
# QuickTime 4.0 VFPAPI Plugin #
# VFAPISource("MOV","path\foo.mov") #
# #
# CSTRâtâ@âCâïüEâèü[â_ü[ #
# VFAPISource("CSTR","path\foo.cstr") #
########################################

function VFAPISource(string "vf", string "fn")
{
default(vf,"D2V")
# this^ 'u' was added by me ;-)

vf = (vf=="D2V") ? d2v_dir+"\DVD2AVI.vfp" :
\ (vf=="AUP") ? aup_dir+"\aviutl.vfp" :
\ (vf=="TPR") ? tpr_dir+"\TMPGEnc.vfp" :
\ (vf=="M2V") ? m2v_dir+"\m2v.vfp" :
\ (vf=="MOV") ? mov_dir+"\QTReader.vfp" :
\ (vf=="CSTR") ? str_dir+"\CSTR.VFP" : 0

LoadVFAPIPlugin(vf,"_VFAPISource")
FlipVertical(_VFAPISource(fn))
}


This script an then be easily used, for example like that:

Load_MOV.avs:
Import("?:\*\vfapi.avs")
VFAPISource("MOV", "?:\*\*.mov")


Of course, you'll have to substitute each '?' and '*' with the appropriate value (drive, path/filename).