okay, here's the deal, in gripping detail.
I am trying to take some video footage and turn it into motion ascii art - similar to THIS. I want my output file to be a valid video file... avi, mpeg, etc., not a Java or txt.
So far, I have found image-to-acsii convertors that will make the images I want, and will do batch conversions, but they output as text files.
One of the programs supports taking the ascii text and exporting it back out as an image file, but it has no batch processing capability. If I can get a series of these converted, I can put them back together as a sequence of frames, and it'll all be hunky dory.
What I need then is a way to automate the opening of the text file, and the outputting of the image files, so that I can turn it loose on a file folder and have it run through all the .txt files and convert them to images.
Is there a way to do this with a batch file? Am I asking too much? I haven't worked with batch files, so I'm somewhat confused by the tutorials I've dug up - either they are aimed at someone with more knowledge of the process, or I'm just missing some crucial point.
any info, leads or links appreciated.
Thanks.
+ Reply to Thread
Results 1 to 9 of 9
-
- housepig
----------------
Housepig Records
out now:
Various Artists "Six Doors"
Unicorn "Playing With Light" -
batch file as in DOS box or command line batch?
It can probably do what you want, in fact i'm pretty sure it can, it's just a question of hitting the right command. the only problem i see would be incremental filenames, i.e. you have have frame1.txt frame 2.txt frame 3.txt etc, which want to be converted to frame1.bmp frame2.bmp etc.
Perhaps another option would be to use something like the sub station alpha plugin for vdub, which will overlay text like subs onto a video. simply open a blank video, load the plugin and set colours/sizing and let it go.
i know for sure you could write a qbasic program to do it for you (i remember some of the commands in it), but i think qbasic disappeared after 98......... -
Well the firts thinsg you need to do is learn how to controll all your programs from the command line. i.e how to provide input and output filenames, set parameters and switches etc. If you can't do this, batch processing would be no use to you.
I use batch files occasionally (mostly at work) and may be able to help if you can provide a little more detail, though I wouldn't be at all surprised to find others here with better knowledge of some of the more powerful command line features available in Win2k/XP compared to what was available in win9x. -
Originally Posted by flaninacupboard
that's exactly what I mean.. that's one of those areas of computing that, since I didn't really touch a computer between the days of BASIC and the advent of Windows 3.1, I'm woefully ignorant about DOS commands, batch programs, working effectively from a command line, etc.
I'll have to check the Sub Station Alpha - if it'll let me do top-to-bottom, side to side subs, it could work. Have you worked with it much? how big a pain would it be to put a text file in every frame?
Thanks for the info.- housepig
----------------
Housepig Records
out now:
Various Artists "Six Doors"
Unicorn "Playing With Light" -
@flan -
did some checking on Sub Station Alpha ... man! that's some hectic stuff - I'm so glad I'm not an anime fan, some of that stuff would drive me nuts!
I'm going to download it and play around, see if I can get it to format correctly.... if I can, sweet! life will be good.
thanks for the tip.
@bugster -
I know, I know.. I need to learn more about working with DOS & working from the command line... you have any good resources for me?- housepig
----------------
Housepig Records
out now:
Various Artists "Six Doors"
Unicorn "Playing With Light" -
-
I used it for laying subs onto my star wars conversions, with hand written scripts (took a while!) and from memeory you just set a top offset and a left offset. so leave both as 0, an it'll just start in the top left corner.
If you let us know the names of your programs, i will download and have a play, ascertain if they can/what the command line options are, and we can go from there. -
Instead of DOS batch files, use VBScript. More control and there are script sources you raid and learn from. Win98 and later have WSHost built in. (see WSHost on the microsoft.com site for details).
see http://www.ericphlelps.com for some scripts.
Here is a sample of a script I wrote. It opens a directory, scans for images, call a program to modify the images, creates a script file for avs, has a true percentage progress bar, and has a 'pick a file' for choices.
Yeah it should be a program, but it grew as a I added stuff.
Code:' ' This script processes images using ImageMagick (www.imagemagick.org) ' to prepare them for use as elements in a slideshow or video montage ' 'Parts of this script are from www.ericphlelps.com ' ' Version 0.9.8 ' 'Notes 'Use only copies of images not the originals 'imagamagick must be installed with the path c:\imagemagick or the script must ' be changed ' Option Explicit Dim Dir, cmds1, cmds2, fade Dim images(), menus, dt Dim bkgnd, avsstr, newfil Dim fs, avs, sh, wsh, ts Dim tv, framerate, res, w, h Dim fil 'As Scripting.Files Dim fils 'As Scripting.File Dim intCounter, intCounter2, i 'As Integer Dim gdocProgressBar 'Required global declaration for status bar document Dim goieProgressBar 'Required global declaration for Internet Explorer object Set gdocProgressBar = Nothing Set goieProgressBar = Nothing ' Define all the constants we will (or might) need Const TemporaryFolder = 2 'Scripting.SpecialFolderConst.TemporaryFolder Const ForWriting = 2 'Scripting.IOMode.ForWriting Const WshHide = 0 'IWshRuntimeLibrary.WshWindowStyle.WshHide Const WshNormalFocus = 1 'IWshRuntimeLibrary.WshWindowStyle.WshNormalFocus Const WshMinimizedFocus = 2 'IWshRuntimeLibrary.WshWindowStyle.WshMinimizedNoFocus Const WshMaximizedNoFocus = 3 'IWshRuntimeLibrary.WshWindowStyle.WshMaximizedNoFocus Const WshNormalNoFocus = 4 'IWshRuntimeLibrary.WshWindowStyle.WshNormalNoFocus Const WshMinimizedNoFocus = 6 'IWshRuntimeLibrary.WshWindowStyle.WshMinimizedNoFocus Set wsh = CreateObject("Wscript.Shell") Set fs = CreateObject("Scripting.FileSystemObject") 'Check to see we got a folder to start with If Wscript.Arguments.Count = 0 Then MsgBox "Drop a directory on this script" Wscript.Quit 1 End If Dir = WScript.Arguments(0) If Not fs.FolderExists(Dir) Then MsgBox "Drop a DIRECTORY on this script." Wscript.Quit 1 End If Set fils = fs.GetFolder(Dir).Files ' Get the number of files to work on intCounter=0 For each fil in fils If (Right(fil.Name, 4) = ".jpg") Then intCounter=intCounter+1 : ReDim Preserve images (intCounter+1): images(intCounter)=fil Next i=intCounter 'reset counter intCounter=0 'get a backgound image bkgnd = BrowseForFile("Select Background Image:", "Select File") 'type of transition fade = ChooseOne("Fade to Black" & vbTab & "Cross Dissolve" & vbTab & "Cut-n-Splice" & vbTab,"Transition" ) 'get pal-ntsc '-------use tv = ChooseOne("NTSC" & vbTab & "PAL" & vbTab,"TV System") If (tv="PAL") Then framerate = 25 Else framerate = 29.97 '-------or 'framerate = 25 'tv = "PAL" '-------or 'framerate = 29.97 'tv = "NTSC" 'get final resolution of montage '---------use res = ChooseOne("D1 DVD" & vbTab & "D1 Broadcast" & vbTab & "VCD" & vbtab, "Format") Select Case res Case "D1 DVD" w = 720 if tv="NTSC" then h = 540 else h = 576 Case "D1 Broadcast" w = 704 if tv="NTSC" then h = 480 else h = 576 Case "VCD" w = 352 if tv="NTSC" then h = 240 else h = 288 Case Else MsgBox "Format Error" : Stop End Select '---------or 'res = "D1 Broadcast" 'h = 720 'if tv="NTSC" then h = 480 else h = 576 '---------or 'res = "VCD" 'h = 352 'if tv="NTSC" then h = 240 else h = 288 '--------or 'res = "D1 DVD" 'w = 720 'h = if tv="NTSC then h = 540 else h = 576 'open file for AVS script Set avs=fs.createTextFile(Dir+"\montage.avs") avs.WriteLine("# read or edit using a fixed width font") avs.WriteLine("") avs.WriteLine("################################################") avs.WriteLine("# #") avs.WriteLine("# Photo Montage #") avs.WriteLine("# #") avs.WriteLine("# This creates a photo montage video clip, #") avs.WriteLine("# also called a slideshow. #") avs.WriteLine("# This version is "&fade&" #") avs.WriteLine("# between photos. Display time is set #") avs.WriteLine("# using a constant. Image input is assumed to #") avs.WriteLine("# be in the proper resolution and the pixel #") avs.WriteLine("# aspect ratio accounted for. #") avs.WriteLine("# #") avs.WriteLine("################################################") avs.WriteLine("") avs.WriteLine("") avs.WriteLine("################################################") avs.WriteLine("# #") avs.WriteLine("# Constants - #") avs.WriteLine("# This is to make it eaiser to #") avs.WriteLine("# modify global values. Mostly a standard #") avs.WriteLine("# header. #") avs.WriteLine("# #") avs.WriteLine("################################################") if tv="NTSC" then framerate = 30 avs.WriteLine("FrameRate = " & framerate) avs.WriteLine("PluginPath = "&chr(34)&"C:Program Files\AVISynth2\plugins\"&chr(34)) avs.WriteLine("width = "&w) avs.WriteLine("height = "&h) avs.WriteLine("FaderLen = 1 * FrameRate # length of fade i/o frames (number=seconds)") avs.WriteLine("DisplayTime = 6 * FrameRate # length of pic diplay in frames (number=seconds)") avs.WriteLine("") avs.WriteLine("") avs.WriteLine("################################################") avs.WriteLine("# #") avs.WriteLine("# Load plugins #") avs.WriteLine("# #") avs.WriteLine("################################################") avs.WriteLine("LoadPlugin(PluginPath + "&chr(34)&"ImageSequence.dll"&chr(34)&")") avs.WriteLine("") avs.WriteLine("") avs.WriteLine("") avs.WriteLine("################################################") avs.WriteLine("# #") avs.WriteLine("# Main Script #") avs.WriteLine("# #") avs.WriteLine("################################################") avs.WriteLine("") avs.WriteLine("# Cn are the image clips (n=1 --> some number)") avs.WriteLine("") 'convert images and place on background For intCounter = 1 to i ProgressBar (intCounter/i)*100,"Image Processing" newfil = Left(images(intCounter),Len(images(intCounter))-4)& ".bmp" cmds1 = "C:\Imagemagick\composite.exe -gravity center -geometry 690x518 "&images(intCounter)&" "&bkgnd&" "&newfil cmds2 = "C:\Imagemagick\convert.exe -level 16 "&Dir&"\"&newfil&" "&Dir&"\"&newfil wsh.Run cmds1, WshHide, True wsh.Run cmds2, WshHide, True avsstr = "C"&intCounter&" = ImageSequence("&chr(34)&newfil&chr(34)&",1,1,"&fix(framerate)+1&").Loop(DisplayTime)" avs.WriteLine avsstr Next ProgressBar -1,"" avsstr="" avs.WriteLine("") Select Case fade Case "Fade to Black" avsstr = "C0 = " for intCounter = 1 to i If (intCounter <> i) Then avsstr = avsstr&"FadeIO(C"&intCounter&",FaderLen) + \ "&vbCRLF Else avsstr = avsstr&"FadeIO(C"&intCounter&",FaderLen)"&vbCRLF next avs.WriteLine avsstr Case "Cross Dissolve" avsstr = "Dissolve(C1,C2,FaderLen)" avs.WriteLine avsstr for intCounter = 3 to i avsstr ="Dissolve(last,C"&intCounter&",FaderLen)" avs.WriteLine avsstr next avs.WriteLine("C0 = FadeIO(last,FaderLen)") Case "Cut-n-Splice" for intCounter = 1 to i If (intCounter <> i) Then avsstr = avsstr&"C"&intCounter&" + " Else avsstr = avsstr&"C"&intCounter&vbCRLF next avs.WriteLine avsstr avs.WriteLine("C0 = FadeIO(last,FaderLen)") Case Else Msgbox "Fader error" : Stop End Select avs.WriteLine("") avsstr = "" 'resize montage to selected format avs.WriteLine("C0 = BilinearResize(C0," & w & "," & h & ")") if tv="NTSC" then avs.Writeline ("return C0.ConvertToYUY2.ConvertFPS("&framerate&")") else avs.WriteLine("return C0") avs.close 'menu-thumbnails ' make thumbnails For intCounter = 1 to i ProgressBar (intCounter/i)*100,"Making Thumbnails" cmds1 = "C:\Imagemagick\convert.exe "&images(intCounter)&" -resize 116x116 "&Dir&"\temp"&intCounter&".bmp" cmds2 = "C:\Imagemagick\convert.exe "&Dir&"\temp"&intCounter&".bmp -bordercolor #101010 -border 90x90 -gravity center -crop 118x118+0+0 "&Dir&"\temp"&intCounter&".bmp" wsh.Run cmds1, WshHide, True wsh.Run cmds2, WshHide, True Next Progressbar -1,"" ' make menus menus = Fix(i/8) + 1 dim tempbmp For intCounter = 1 to menus ProgressBar (intCounter/menus)*100,"Making Menus" tempbmp = intCounter*8-7 cmds1 = "C:\Imagemagick\convert.exe "&bkgnd&" " if (tempbmp <= i) Then cmds1 = cmds1 + "-page +78+123 "&Dir&"\temp"&tempbmp&".bmp " if (tempbmp+1 <= i) Then cmds1 = cmds1 + "-page +243+123 "&Dir&"\temp"&tempbmp+1&".bmp " if (tempbmp+2 <= i) Then cmds1 = cmds1 + "-page +408+123 "&Dir&"\temp"&tempbmp+2&".bmp " if (tempbmp+3 <= i) Then cmds1 = cmds1 + "-page +573+123 "&Dir&"\temp"&tempbmp+3&".bmp " if (tempbmp+4 <= i) Then cmds1 = cmds1 + "-page +78+311 "&Dir&"\temp"&tempbmp+4&".bmp " if (tempbmp+5 <= i) Then cmds1 = cmds1 + "-page +243+311 "&Dir&"\temp"&tempbmp+5&".bmp " if (tempbmp+6 <= i) Then cmds1 = cmds1 + "-page +408+311 "&Dir&"\temp"&tempbmp+6&".bmp " if (tempbmp+7 <= i) Then cmds1 = cmds1 + "-page +573+311 "&Dir&"\temp"&tempbmp+7&".bmp " cmds1 = cmds1 + "-mosaic "&Dir&"\menu"&intCounter&".bmp" cmds2 = "C:\Imagemagick\convert.exe -level 16 "&Dir&"\menu"&intCounter&".bmp "&Dir&"\menu"&intCounter&".bmp" wsh.Run cmds1, WshHide, True wsh.Run cmds2, WshHide, True Next ProgressBar -1,"" 'Finished MsgBox "Done"
-
stiltman & themichael -
thanks for the leads & code! I'm totally open to VBS, hell, I'll draw a circle in chicken blood if it'll get this stuff done without having to open everything by hand!
I'm so beat right now, I'm not going to get to play around until tomorrow night, but I know what I'm going to be looking up at work tomorrow...
thanks again. man, I love this board!- housepig
----------------
Housepig Records
out now:
Various Artists "Six Doors"
Unicorn "Playing With Light"
Similar Threads
-
Batch "file creation from a text file, Placed into a created directory
By Muther in forum ProgrammingReplies: 5Last Post: 24th Sep 2015, 18:29 -
Batch file that can delete a specific file
By Dark_Raven in forum ProgrammingReplies: 1Last Post: 10th Jun 2008, 08:16 -
"Master" Master Audio Volume Control?
By Soopafresh in forum ComputerReplies: 1Last Post: 19th Mar 2008, 08:57 -
Automate chapters?
By Neisse in forum Authoring (DVD)Replies: 7Last Post: 27th Jul 2007, 18:38 -
Is there a prog to preview a srt subtitle in a vob file ?
By mordor in forum SubtitleReplies: 4Last Post: 11th Jun 2007, 20:49