|
|
filename inserted into subtitle script?
is there a script that can insert the avi filename as a subtitle... for example if the filename is quot;2006-03-23 My Movie.aviquot; then it generates a subtitle of the same name without the file extension.
Thanks, Pete
Well, basically you could do something like:
Code:
function FindStrR(string s, string t)
{ index = FindStr(RevStr(s), RevStr(t)) - 1 return (index == -1) ? 0 \ : StrLen(s) - StrLen(t) - index + 1
}function LabeledAVISource(string filename)
{ offset = FindStrR(filename, quot;.quot;) Assert(offset != 0) return AVISource(filename).Subtitle(LeftStr(filename, offset - 1))
}thanks so much for that... sorry about this but i'm a real newbie at this... how do i exactly get this code to work?
thanks again
Pete
PS whilst I've got a good helper here could you also this question?...
Is there a way I can load an avisynth script AND my VD processor settings (.vcf) from one file?
for example... I want to load an avisynth subtitle script AND my set of VD filters (ctrl+L) in as least amount of clicks as possible.
Thanks heaps,
Pete
Simply copy and paste it into your script, and instead of using AVISource(quot;someFile.aviquot;), use LabeledAVISource(quot;someFile.aviquot;).
Thanks again for that, you've been a geat help. I got it working. However it produces the whole file path rather than just the filename... can this be fixed? TIA. This is my script... As you can see the current file path is very long. If there is a way to just have the 2006-03-13 0945 Angus 11 part then it would make it perfect.
filename = quot;C:\Documents and Settings\Pete and Angus\My Documents\My Videos\To be processed\2006-03-13 0945 Angus 11.aviquot;
LabeledAVISource(filename)
function FindStrR(string s, string t)
{ index = FindStr(RevStr(s), RevStr(t)) - 1 return (index == -1) ? 0 \ : StrLen(s) - StrLen(t) - index + 1
}function LabeledAVISource(string filename)
{ offset = FindStrR(filename, quot;.quot;) Assert(offset != 0) return AVISource(filename).Subtitle(align=3,font=quot;arialquot;,size=15, text_color=$ffffff, LeftStr(filename, offset - 1))
}
Subtitle(align=8,font=quot;arialquot;, size=15, text_color=$ffffff, GetFileInfo(filename, quot;creationTimequot;))
Thanks again for that, you've been a geat help. I got it working. However it produces the whole file path rather than just the filename... can this be fixed? TIA. This is my script... As you can see the current file path is very long. If there is a way to just have the 2006-03-13 0945 Angus 11 part then it would make it perfect.
filename = quot;C:\Documents and Settings\Pete and Angus\My Documents\My Videos\To be processed\2006-03-13 0945 Angus 11.aviquot;
LabeledAVISource(filename)
function FindStrR(string s, string t)
{ index = FindStr(RevStr(s), RevStr(t)) - 1 return (index == -1) ? 0 \ : StrLen(s) - StrLen(t) - index + 1
}function LabeledAVISource(string filename)
{ offset = FindStrR(filename, quot;.quot;) Assert(offset != 0) return AVISource(filename).Subtitle(align=3,font=quot;arialquot;,size=15, text_color=$ffffff, LeftStr(filename, offset - 1))
}
Subtitle(align=8,font=quot;arialquot;, size=15, text_color=$ffffff, GetFileInfo(filename, quot;creationTimequot;))
Okay, try this instead:
Code:
function FindStrR(string s, string t)
{ index = FindStr(RevStr(s), RevStr(t)) - 1 return (index == -1) ? 0 \ : StrLen(s) - StrLen(t) - index + 1
}function LabeledAVISource(string filename)
{ baseOffset = FindStrR(filename, quot;\quot;) baseOffset = baseOffset != 0 ? baseOffset : FindStrR(filename, quot;/quot;) extOffset = FindStrR(filename, quot;.quot;) Assert(extOffset != 0) AVISource(filename) Subtitle(MidStr(filename, baseOffset + 1, extOffset - 1)) return last
}
Edit: Oops. Bug fixed.
thanks, but... still the same, has the whole file path as the subtitle.
I was thinking of another way???... is it easier enough to extract the filename from the movie, and place it into a certain position in a .ssa text file?
thanks for you (ongoing) help
Pete
Oops. I accidentally used FindStr instead of FindStrR. I updated the script above.
Perfect, thanks for that. It works a treat.
You're gonna hate me for this but... do you know how to incorporate this into my Virtualdub .vcf process settings so that it applies to the movie file currently loaded in VD? I know to to include a avisynth script for a specific file within the script (like this script), but can it be done to any file that is loaded into VD... am i making sense? At the moment if I want to incorporate your great script you made me into more than one file I will need to either change the file name one by one or do the batch script thing. I'd like to be able to apply your script to the movie file currently on VD.
Thanks again in any case I'll be using this heaps...
Pete
anyone know how to do this?
Doesn't sound possible.
could i insert this script in autogk (autogk uses avisynth doesn't it?) somehow so that all the movies i convert have their filename as a subtitle? |
|