My Departement Of Nerdcore Enthusiasm

Tutorials and the like. Things which I have committed myself to. Often linux/UNIX-related.

mandag den 17. oktober 2011

Create scrolling move text from a pdf file

If you look around on this blog you can see that much of it is about being able to produce video effect without a fancy graphic video editing program. I find it fuzzy to work with these heavy video editing programs when I often sit and just have a small computer at my disposal. My scripts can produce a good result without me having to sit and pull elements in place with the mouse drag-and-drop in a graphics program. I can instead give a precise command from a commando line and then just wait to see the job gets done. This script can be slow to get through the process. The example of “rolling credits” shown here took about half an hour to process on my little ASUS eee pc. But in that time I am free to work on something else. That works fine for me.

This script creates scrolling text video clip like the rolling credits of a movie. It makes it out of a PDF or PS (PostScript) document. That is when you want to produce your rolling credits, you simply typing them into a word processing program like OpenOffice Writer or AbiWord, etc. and then save (save a copy or export) as a pdf (almost any modern word processor will do this). You should set the page size to A4 paper size. Top and bottom margin should be an inch with is equal to 2.54 cm. The spread of your document equals to the screen stretched so the distance you have between the text and the edges of the document corresponds to what you're going to see on the screen.  I have usede a Font Size of 20 points which I think is a good starting point but it is up to you. You can format text just like you would in your word processing system. Use black for the text and white for the background. Although the text is spread out over several pages in the word processing program try to imagine that it's just one long continuous text when you set it up. The resulting video clip is white text on black background. This concept can obviously be expanded so that the text will run over the "living pictures" in your video, but it leads too far now. The script is also currently limited to producing a video output in VGA format 640 x 480 pixels.

For this script to work you must have the following programs on your computer:

1. The scripted is a bash shell script so you must have a bash shell environment that you have on most Unix platforms. OS X, Linux (Ubuntu, Red Hat, puppy etc), Solaris, etc.

2. The basic program package Netpbm command-line based and script-based image processing.

3. Ghostscript (GS), the classic Gnu / open-source tool for PDF and PostScript handeling.

4. Ffmpeg a really nice strong basic commando line based film/video editing and conversion tool.

To run the script you must have opened a terminal window. Xterm Aterm.. whatever. Then, in your working directory you should have your PostScript file and the script. You give PDF or PostScript file as an argument to the script like this:

./rolling yourfile.pdf

and now it will take a while to produces a video clicp script with "rolling credits" out of your document.

The script is here. If you want to download it you can right-click and then choose save target as, or similar. Now make sure the script is executable. You can probably also do the right-click action or from a commando line with

chmod +x rolling

http://www.mimoart.ooz.dk/rolling

If for some reason would want to see the pdf file I've used as the basis for this video eksepel so it is here.

http://www.mimoart.ooz.dk/youare.pdf