The suggestion in the comment is correct. Make a beamer presentation, and then get a screen filming application to film the result.
In case you want a pure bash solution, you would have to devise a script that uses the watch function to run a script which takes a printscreen 10 times a second, and run this script at whatever framerate you wish to use, divided by 10. Here is an example of such a script:
#!/bin/bash
a=`cat ~/index`
if [ $1 -ne 0 ]
then
echo $((a+$1)) > /users/morgan/x/index
fi
xwd -root | convert xwd:- ~/$((a+$2)).png
cat end
One problem you run into is parallelism: making sure all your frames are synchronized. For this I used a file called index to have one central reference for all copies of the script to refer to. The other problem you run into is ending all instances at the same frame. To solve this problem, the script above cats the file end, which tells all the watch commands whether to end watching.
Finally, here is the script that I used that coordinates all of the watch commands; it calls the above script in a filename i.sh:
#!/bin/bash
echo n > end # don't end watching
echo 0 > index # start at frame 0
a=1 # which instance of `watch` we're starting
b=` bc -l <<< $(echo 1/$1 - .001) `#* amount of time between starting the `watch` instances
while [ $a -lt $1 ]
do
( watch -pgn .1 ./i.sh 0 $a ) & # the -p tells `watch` to be more precise
#date +%N # line which you use to calibrate timing on your PC
a=$((a+1))
sleep $b
done
( watch -pgn .1 ./i.sh $1 $a ) & # last instance increments the `index` by $1
timeout $2 evince -s $3 # run presentation file $3 for $2 seconds
echo y > end # this should abort all `watch` instances
The usage is:
./run.sh [fps / 10] [no. of seconds to film] [presentation PDF name]
- Note: The .001 is the amount of time on my computer needed to run one iteration of the loop, to make sure all frames are synchronized. In order to time this on your computer, you uncomment the #date line, and then the script would display the nanoseconds at which your script begins. You then would adjust the .001 up or down, to make sure there is as close to the needed gap as practical.
One disadvantage is, that the watch commands don't know how soon the PDF viewer finishes loading and the presentation starts. For this reason, you will have to discard all printscreens that get captured before your PDF reader loads, and also add a few seconds to your presentation length, which you can discard after the capturing is done.
This is a pure bash solution, but I would suggest using the more conventional method of using a third-party utility to do the filming, unless there is a good reason not to (e.g. you don't have root access; your system is too old to support external utilities; you believe in using only open-source software; etc.).
And of course, after deleting the files at the beginning and at the end, you would then use ffmpeg as you wrote above to make the movie file. Unfortunately, no faster-than-realtime solution seems to exist out there.