/* * rename.pov - (image) file rename tool * * Copyright 2005 Jaap Stolk * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. */ // generates a unix/DOS script file, witch can be used to rename files. // // WARNING: // I'm just working out how to do this, so I may be completely wrong. // Use at your own risk, guess amount of involved risk at your own risk. // // Version: 30 April 2005 - now actually using fileExt // - added re-naming/re-numbering // // Version: 22 March 2005 - first release // // Usage: // -set the output settings // -run this file in povray // -run the generated script file // // Why ? // It renames xxxxx0012.xxx to: xxxxx12.xxx so the images can be used // as input for ffmpeg (followed by ffmpeg2theora) // (you also need to convert the images to jpg for ffmpeg) // // But what if I don't want to do that ? // This can also be used to do other renaming tricks, like shifting a // numbers form "news01.png..news15.png" to "news1234.png..news1249.png" // (to "edit" animations, combine different "shots", etc.) // // PovRay animation mini-HOWTO: // (all used tools are avalable for both linux and windows) // step 1: render images. (see povray documentation "animation, options") // (+w720 +h400 +a0.3 -j Final_Clock=5.0 Final_Frame=250 +FN) // (both w and h must be multiples of 16) // step 2: convert to jpg (can also be done after renaming) // step 3: generate rename script file (if changed) // step 4: run rename script // step 5: ffmpeg -hq -qscale 1 -i news%d.jpg news.mpg // (or: ffmpeg -hq -qscale 1 -i news%d.jpg -i news.wav news.mpg) // (or: ffmpeg -hq -qscale 1 -i news%d.jpg -i news.mp3 news.mpg) // step 6: ffmpeg2theora --aspect 720:400 news.mpg // (set the "--aspect" option to width:height) // ( use the --endtime if your audio track is to long) // step 7: play in VLC (vlc news.mpg.ogg) // (see ffmpeg and ffmpeg2theora documentation for more options) // // Links: // http://www.theora.org/ // http://www.theora.org/theorafaq.html // http://ffmpeg.sourceforge.net/ // http://ffmpeg.sourceforge.net/ffmpeg-doc.html // http://www.google.com/search?q=ffmpeggui02c.zip // http://www.v2v.cc/~j/ffmpeg2theora/ // http://www.v2v.cc/~j/ffmpeg2theora/download.html // http://www.videolan.org/vlc/ /* options: usage: ffmpeg2theora [options] input Output options: --output,-o alternative output --width, -x scale to given size --height,-y scale to given size --aspect define frame aspect ratio: i.e. 4:3 or 16:9 --crop[top|bottom|left|right] crop input before resizing --videoquality,-v [0 to 10] encoding quality for video --videobitrate,-V [45 to 2000] encoding bitrate for video --sharpness,-S [0 to 2] sharpness of images(default 2) { lower values make the video sharper. } --keyint,-K [8 to 65536] keyframe interval (default: 64) --audioquality,-a [-1 to 10] encoding quality for audio --audiobitrate,-A [45 to 2000] encoding bitrate for audio --samplerate,-H set output samplerate in Hz --channels,-c set number of output sound channels --nosound disable the sound from input --endtime,-e end encoding at this time (in sec) --starttime,-s start encoding at this time (in sec) --v2v-preset,-p encode file with v2v preset, right now there is preview and pro, 'ffmpeg2theora -p info' for more informations Input options: --deinterlace,-d force deinterlace otherwise only material marked as interlaced will be deinterlaced --format,-f specify input format --inputfps [fps] override input fps Metadata options: --artist Name of artist (director) --title Title --date Date --location Location --organization Name of organization (studio) --copyright Copyright --license Licence Other options: --debug output some more information during encoding --help,-h this message Examples: ffmpeg2theora videoclip.avi (will write output to videoclip.avi.ogg) cat something.dv | ffmpeg2theora -f dv -o output.ogg - Live encoding from a DV camcorder (needs a fast machine) dvgrab - | ffmpeg2theora -f dv -x 352 -y 288 -o output.ogg - Live encoding and streaming to icecast server: dvgrab --format raw - | \ ffmpeg2theora -f dv -x 160 -y 128 -o /dev/stdout - | \ oggfwd iccast2server 8000 password /theora.ogg */ // ------------------------------------------------------------------------ // | SETTINGS: | // ------------------------------------------------------------------------ //#declare osUnix = 1; // (linux mode, disable this for windows) #declare oldName = "news"; // if you start with news001.jpg then use: "news" #declare newName = oldName; // (normally same as oldName, unless you are renaming) #declare fileExt = "jpg"; // if you start with news001.jpg then use: "jpg" #declare digits = 3; // if you start with news001.jpg then use: 3 #declare first = 1; // if you start with news001.jpg then use: 1 #declare last = 250; // if you end with news250.jpg then use: 250 #declare newFirst = first; // (normally same as first, unless you are renumbering) // carfull when renumbering!: use a different newName !! // when renumbering a set that does not have leading zero's // also adapt the code below. // ------------------------------------------------------------------------ #ifdef(osUnix) // unix mode: #declare renameCommand = "mv"; #declare scriptName = "rename.sh"; #declare comment = "# "; #else // dos mode: #declare renameCommand = "rename"; #declare scriptName = "rename.bat"; #declare comment = "REM "; #end #if(first=newFirst) #else //#if(oldName=newName) // #error "ERROR: re-numbering may overlap!, use different names." //#end #end #fopen script scriptName write #write (script,concat(comment,"This file is generated by rename.pov and\n")) #write (script,concat(comment,"will be overwritten if you run rename.pov !\n")) #declare i=first; #while (i < (last+1)) #write (script,concat(renameCommand," ")) // old filename: #write (script, oldName) #write (script, str(i,-digits, 0)) // for removing zero's //#write (script, str(i,0, 0)) // for renaming/re-numbering #write (script, ".") #write (script, fileExt) #write (script, " ") //(space) // new filename: #write (script, newName) #write (script, str(i+(newFirst-first),0, 0)) #write (script, ".") #write (script, fileExt) #write (script, "\n") //(next line) #declare i=i+1; #end #fclose script // ------------------------------------------------------------------------